]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: macb: check clk_set_rate return value to be negative
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Tue, 19 Jan 2021 11:26:45 +0000 (13:26 +0200)
committerEugen Hristev <eugen.hristev@microchip.com>
Fri, 22 Jan 2021 13:09:59 +0000 (15:09 +0200)
clk_set_rate() returns the set rate in case of success and a
negative number in case of failure. Consider failure only the
negative numbers.

Fixes: 3ef64444de157 ("dm: net: macb: Implement link speed change callback")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
drivers/net/macb.c

index 097d5787109319b1822a6414545c6a548a0945e4..80ed58d4b9088f79dc077ec2dbb09929cf5696f1 100644 (file)
@@ -631,7 +631,7 @@ int __weak macb_linkspd_cb(struct udevice *dev, unsigned int speed)
 
        if (tx_clk.dev) {
                ret = clk_set_rate(&tx_clk, rate);
-               if (ret)
+               if (ret < 0)
                        return ret;
        }
 #endif