phy: nop-phy: Fix phy reset if no reset-gpio defined

Ensure there is a valid reset-gpio defined before using it.

Fixes: f9852acdce ("phy: nop-phy: Fix enabling reset")
Cc: Adam Ford <aford173@gmail.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
This commit is contained in:
Tim Harvey 2022-02-28 14:53:21 -08:00 committed by Marek Vasut
parent f9a719e295
commit a41b88ec02

View File

@ -45,11 +45,13 @@ static int nop_phy_init(struct phy *phy)
#if CONFIG_IS_ENABLED(DM_GPIO)
/* Take phy out of reset */
ret = dm_gpio_set_value(&priv->reset_gpio, false);
if (ret) {
if (CONFIG_IS_ENABLED(CLK))
clk_disable_bulk(&priv->bulk);
return ret;
if (dm_gpio_is_valid(&priv->reset_gpio)) {
ret = dm_gpio_set_value(&priv->reset_gpio, false);
if (ret) {
if (CONFIG_IS_ENABLED(CLK))
clk_disable_bulk(&priv->bulk);
return ret;
}
}
#endif
return 0;