From: Jean-Jacques Hiblot <jjhiblot@ti.com>
Date: Thu, 26 Sep 2019 13:42:42 +0000 (+0200)
Subject: clk: Fix error check in clk_set_default_parents()
X-Git-Tag: v2025.01-rc5-pxa1908~2723^2~6
X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=02e2a2ad2f01a5b88e3ff2b694de63c0b5c849f2;p=u-boot.git

clk: Fix error check in clk_set_default_parents()

According to the documentation in clk.h, clk_set_parent() return the new
rate of the clock or a negative error code.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 64c181f4ad..bf1adc09ab 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -223,7 +223,7 @@ static int clk_set_default_parents(struct udevice *dev)
 		if (ret == -ENOSYS)
 			continue;
 
-		if (ret) {
+		if (ret < 0) {
 			debug("%s: failed to reparent clock %d for %s\n",
 			      __func__, index, dev_read_name(dev));
 			return ret;