The probe routine for the Maxio PHY returns early if the optional
maxio,clk-out-frequency-hz property is not found. That prevents looking
for other properties.
Refactor the routine to handle the property in an if-clause, to allow
more actions in the probe routine later.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
drivers/net/phy/maxio.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/maxio.c b/drivers/net/phy/maxio.c
index d2cb238956460..9ba82c1cd8b13 100644
--- a/drivers/net/phy/maxio.c
+++ b/drivers/net/phy/maxio.c
@@ -43,18 +43,20 @@ static int maxio_mae0621a_probe(struct phy_device *phydev)
ret = device_property_read_u32(dev, "maxio,clk-out-frequency-hz",
&frequency);
- if (ret == -EINVAL)
- return 0;
- if (ret)
- return ret;
-
- if (frequency != 125000000) {
- phydev_err(phydev, "invalid CLKOUT frequency %u\n", frequency);
- return -EINVAL;
+ if (ret) {
+ /* the property is optional, so ignore -EINVAL */
+ if (ret != -EINVAL)
+ return ret;
+ } else {
+ if (frequency != 125000000) {
+ phydev_err(phydev, "invalid CLKOUT frequency %u\n",
+ frequency);
+ return -EINVAL;
+ }
+
+ priv->clk_out_125m = true;
}
- priv->clk_out_125m = true;
-
return 0;
}
--
2.46.4