[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240211150804.3893-1-d.dulov@aladdin.ru>
Date: Sun, 11 Feb 2024 07:08:04 -0800
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Woojung Huh <woojung.huh@...rochip.com>
CC: Daniil Dulov <d.dulov@...ddin.ru>, <UNGLinuxDriver@...rochip.com>, Andrew
Lunn <andrew@...n.ch>, Vivien Didelot <vivien.didelot@...il.com>, Florian
Fainelli <f.fainelli@...il.com>, Vladimir Oltean <olteanv@...il.com>, "David
S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Alexandre
Belloni <alexandre.belloni@...tlin.com>, Helmut Grohne
<helmut.grohne@...enta.de>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH 18/18] net: dsa: microchip: Check return value of of_get_phy_mode()
of_get_phy_mode() may return an error, so add a check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: edecfa98f602 ("net: dsa: microchip: look for phy-mode in port nodes")
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
drivers/net/dsa/microchip/ksz_common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index e3c338624b95..faffce6ea1e1 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -434,8 +434,10 @@ int ksz_switch_register(struct ksz_device *dev,
continue;
if (port_num >= dev->mib_port_cnt)
return -EINVAL;
- of_get_phy_mode(port,
+ ret = of_get_phy_mode(port,
&dev->ports[port_num].interface);
+ if (ret)
+ return ret;
}
dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
"microchip,synclko-125");
--
2.25.1
Powered by blists - more mailing lists