]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: qca8k: correctly handle mdio read error
authorAnsuel Smith <ansuelsmth@gmail.com>
Fri, 15 Apr 2022 23:30:16 +0000 (01:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:29:59 +0000 (10:29 +0200)
[ Upstream commit 6cfc03b602200c5cbbd8d906fd905547814e83df ]

Restore original way to handle mdio read error by returning 0xffff.
This was wrongly changed when the internal_mdio_read was introduced,
now that both legacy and internal use the same function, make sure that
they behave the same way.

Fixes: ce062a0adbfe ("net: dsa: qca8k: fix kernel panic with legacy mdio mapping")
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/qca8k.c

index d3ed0a7f80771cfbcffe8bf60a68e4c0a7199597..22b328bd7cd51d47fc58f31820ad6fe95894519d 100644 (file)
@@ -1287,7 +1287,12 @@ qca8k_internal_mdio_read(struct mii_bus *slave_bus, int phy, int regnum)
        if (ret >= 0)
                return ret;
 
-       return qca8k_mdio_read(priv, phy, regnum);
+       ret = qca8k_mdio_read(priv, phy, regnum);
+
+       if (ret < 0)
+               return 0xffff;
+
+       return ret;
 }
 
 static int