Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled

When CONFIG_RESET_CONTROLLER is disabled, the
devm_reset_control_get_exclusive function returns -ENOTSUPP. This is not
handled in subsequent check and then the mdio device fails to probe.

When CONFIG_RESET_CONTROLLER is enabled, its code checks in OF for reset
device, and since it is not present, returns -ENOENT. -ENOENT is handled.
Add -ENOTSUPP also.

This happened to me when upgrading kernel on Turris Omnia. You either
have to enable CONFIG_RESET_CONTROLLER or use this patch.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Fixes: 71dd6c0dff51b ("net: phy: add support for reset-controller")
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Marek Behún and committed by
David S. Miller
075e238d ca749bbb

+2 -1
+2 -1
drivers/net/phy/mdio_bus.c
··· 65 65 reset = devm_reset_control_get_exclusive(&mdiodev->dev, 66 66 "phy"); 67 67 if (IS_ERR(reset)) { 68 - if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOSYS) 68 + if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOSYS || 69 + PTR_ERR(reset) == -ENOTSUPP) 69 70 reset = NULL; 70 71 else 71 72 return PTR_ERR(reset);