]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
mdio_bus: Fix init if CONFIG_RESET_CONTROLLER=n
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 19 Nov 2019 11:25:24 +0000 (12:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2019 09:07:58 +0000 (10:07 +0100)
commit 6e4ff1c94a0477598ddbe4da47530aecdb4f7dff upstream.

Commit 1d4639567d97 ("mdio_bus: Fix PTR_ERR applied after initialization
to constant") accidentally changed a check from -ENOTSUPP to -ENOSYS,
causing failures if reset controller support is not enabled.  E.g. on
r7s72100/rskrza1:

    sh-eth e8203000.ethernet: MDIO init failed: -524
    sh-eth: probe of e8203000.ethernet failed with error -524

Seen on r8a7740/armadillo, r7s72100/rskrza1, and r7s9210/rza2mevb.

Fixes: 1d4639567d97 ("mdio_bus: Fix PTR_ERR applied after initialization to constant")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Marek BehĂșn <marek.behun@nic.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/mdio_bus.c

index bd04fe762056f49c5c28ac3256df820e0e7544ec..2a79c7a7e920d1aef2cde9fd61aa7e716d56f932 100644 (file)
@@ -68,11 +68,12 @@ static int mdiobus_register_reset(struct mdio_device *mdiodev)
        if (mdiodev->dev.of_node)
                reset = devm_reset_control_get_exclusive(&mdiodev->dev,
                                                         "phy");
-       if (PTR_ERR(reset) == -ENOENT ||
-           PTR_ERR(reset) == -ENOTSUPP)
-               reset = NULL;
-       else if (IS_ERR(reset))
-               return PTR_ERR(reset);
+       if (IS_ERR(reset)) {
+               if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOTSUPP)
+                       reset = NULL;
+               else
+                       return PTR_ERR(reset);
+       }
 
        mdiodev->reset_ctrl = reset;