]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: rswitch: Fix error detection
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 6 Aug 2025 10:19:11 +0000 (11:19 +0100)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 6 Aug 2025 14:52:27 +0000 (16:52 +0200)
In rswitch_probe the error detection after the call to devm_clk_get is
very wrong. It checks the value of ret which is uninitialised at that
point. Instead it should be using the macros for including errors into
pointers.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
drivers/net/rswitch.c

index 62d3f39f07184173b13a4cddab0a342069623b0f..f27587ac8bd09f85f247f280f09df863e46397cf 100644 (file)
@@ -1110,8 +1110,10 @@ static int rswitch_probe(struct udevice *dev)
                return -EINVAL;
 
        priv->rsw_clk = devm_clk_get(dev, NULL);
-       if (ret)
+       if (IS_ERR(priv->rsw_clk)) {
+               ret = PTR_ERR(priv->rsw_clk);
                goto err_map;
+       }
 
        ret = clk_prepare_enable(priv->rsw_clk);
        if (ret)