]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
timer: imx-gpt: Fix error detection
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 21 Oct 2025 16:08:30 +0000 (17:08 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 4 Dec 2025 15:38:17 +0000 (09:38 -0600)
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@linaro.org>
drivers/timer/imx-gpt-timer.c

index 07b9fdb5e18c50236bd302f2539da9775ac2b35c..7708d1ba17f2f1460599d374771090083e9313f6 100644 (file)
@@ -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;
        }