Return -EINVAL in case of an address error, otherwise propagate error code.

Signed-off-by: Gerald Loacker <[email protected]>
---
 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


Reply via email to