Revert "mdio_bus: Remove unneeded gpiod NULL check"
[sfrench/cifs-2.6.git] / drivers / net / phy / mdio_bus.c
index b6f9fa67016831745c5ad43dfe466605182daf71..2df7b62c1a36811e97087ae641a89d06641cef4e 100644 (file)
@@ -399,7 +399,8 @@ error:
        }
 
        /* Put PHYs in RESET to save power */
-       gpiod_set_value_cansleep(bus->reset_gpiod, 1);
+       if (bus->reset_gpiod)
+               gpiod_set_value_cansleep(bus->reset_gpiod, 1);
 
        device_del(&bus->dev);
        return err;
@@ -424,7 +425,8 @@ void mdiobus_unregister(struct mii_bus *bus)
        }
 
        /* Put PHYs in RESET to save power */
-       gpiod_set_value_cansleep(bus->reset_gpiod, 1);
+       if (bus->reset_gpiod)
+               gpiod_set_value_cansleep(bus->reset_gpiod, 1);
 
        device_del(&bus->dev);
 }