[PATCH 4/4] net: ksz9477: propagate phy write error
Gerald Loacker
gerald.loacker at wolfvision.net
Fri Sep 8 03:16:49 PDT 2023
Return -EINVAL in case of an address error, otherwise propagate error code.
Signed-off-by: Gerald Loacker <gerald.loacker at wolfvision.net>
---
drivers/net/ksz9477.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c
index d664b7cf01..0310e0260a 100644
--- a/drivers/net/ksz9477.c
+++ b/drivers/net/ksz9477.c
@@ -48,14 +48,12 @@ static int ksz9477_phy_write16(struct dsa_switch *ds, int addr, int reg,
/* No real PHY after this. */
if (addr >= priv->phy_port_cnt)
- return 0;
+ return -EINVAL;
/* No gigabit support. Do not write to this register. */
if (!(priv->features & GBIT_SUPPORT) && reg == MII_CTRL1000)
return 0;
- ksz_pwrite16(priv, addr, 0x100 + (reg << 1), val);
-
- return 0;
+ return ksz_pwrite16(priv, addr, 0x100 + (reg << 1), val);
}
static int ksz9477_switch_detect(struct ksz_switch *priv)
--
2.37.2
More information about the barebox
mailing list