summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-10-21 17:08:29 +0100
committerTom Rini <[email protected]>2025-12-04 09:38:17 -0600
commit40ad377c1619eb9b83d088a96f40b86a907c8c19 (patch)
tree7f9465542735f9d79b858974b4c391814f4e5d4f
parenteb13583b9de27005703ab085d5ef45fcdbb1d4fb (diff)
i2c: imx_lpi2c: Fix error detection
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 <[email protected]> Reviewed-by: Heiko Schocher <[email protected]>
-rw-r--r--drivers/i2c/imx_lpi2c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
index 4636da9f301..a309fd6f07c 100644
--- a/drivers/i2c/imx_lpi2c.c
+++ b/drivers/i2c/imx_lpi2c.c
@@ -304,7 +304,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed)
if (CONFIG_IS_ENABLED(CLK)) {
clock_rate = clk_get_rate(&i2c_bus->per_clk);
- if (clock_rate <= 0) {
+ if (!clock_rate || IS_ERR_VALUE(clock_rate)) {
dev_err(bus, "Failed to get i2c clk: %d\n", clock_rate);
return clock_rate;
}