net: ti: am65-cpsw-nuss: Initialise ret
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 6 Aug 2025 10:43:47 +0000 (11:43 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 15 Aug 2025 19:00:03 +0000 (13:00 -0600)
In am65_cpsw_phy_init it is not certain that ret will be assigned to
before it reaches the 'return ret' statement. Initialise ret to ensure
that ret is valid.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/net/ti/am65-cpsw-nuss.c

index 9b69f36..723dde2 100644 (file)
@@ -628,7 +628,7 @@ static int am65_cpsw_phy_init(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_plat(dev);
        struct phy_device *phydev;
        u32 supported = PHY_GBIT_FEATURES;
-       int ret;
+       int ret = 0;
 
        phydev = dm_eth_phy_connect(dev);
        if (!phydev) {