[PATCH 6/6] timer: imx-gpt: Fix error detection

Andrew Goodbody andrew.goodbody at linaro.org
Tue Oct 21 18:08:30 CEST 2025


Testing an unisgned ivariable to be <= 0 will only detect the
case when it is 0. So correct this error test to a working version that
will behave as expected.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/timer/imx-gpt-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/timer/imx-gpt-timer.c b/drivers/timer/imx-gpt-timer.c
index 07b9fdb5e18c50236bd302f2539da9775ac2b35c..7708d1ba17f2f1460599d374771090083e9313f6 100644
--- a/drivers/timer/imx-gpt-timer.c
+++ b/drivers/timer/imx-gpt-timer.c
@@ -127,7 +127,7 @@ static int imx_gpt_timer_probe(struct udevice *dev)
 
 	/* Get timer clock rate */
 	clk_rate = clk_get_rate(&clk);
-	if (clk_rate <= 0) {
+	if (!clk_rate || IS_ERR_VALUE(clk_rate)) {
 		dev_err(dev, "Could not get clock rate...\n");
 		return -EINVAL;
 	}

-- 
2.47.3



More information about the U-Boot mailing list