diff options
| author | Tom Rini <[email protected]> | 2025-12-04 09:38:46 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-12-04 09:38:46 -0600 |
| commit | 8eed8a355843897258c3f22727b32abe95464b08 (patch) | |
| tree | 4da301a1b2470ecba5c84a241f8aaff1f7bd9fd4 /drivers/timer | |
| parent | 2d08dfc1dc4fc159b13d54535fdca4566b5808d1 (diff) | |
| parent | ce219307a21fe7166b13542ba923ee09aef7f2f5 (diff) | |
Merge patch series "clk: Fix some error detection"
Andrew Goodbody <[email protected]> says:
The function clk_get_rate() returns a ulong with 0 meaning an invalid
clock rate and also negative error codes being returned for other
errors. But being an unsigned return value this cannot simply be tested
for with a < 0 test. Instead use the IS_ERR_VALUE() macro to check for
negative errors appearing as very large positive values. Fix those
places that test for <= 0. Also fix some places checking the return of
clk_register() that incorrectly used ERR_PTR().
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/timer')
| -rw-r--r-- | drivers/timer/imx-gpt-timer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/timer/imx-gpt-timer.c b/drivers/timer/imx-gpt-timer.c index 07b9fdb5e18..7708d1ba17f 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; } |
