diff mbox series

[3/6] net: macb: check clk_set_rate return value to be negative

Message ID 1606987556-20217-4-git-send-email-claudiu.beznea@microchip.com
State Superseded
Delegated to: Eugen Hristev
Headers show
Series add support for sama7g5 ethernet interfaces | expand

Commit Message

Claudiu Beznea Dec. 3, 2020, 9:25 a.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 585d126a17f9..439d1706485c 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -564,7 +564,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;