summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-10-21 17:08:28 +0100
committerTom Rini <[email protected]>2025-12-04 09:38:17 -0600
commiteb13583b9de27005703ab085d5ef45fcdbb1d4fb (patch)
tree77d478f566282d5dfeedc1f768b568677124befd
parentae4f60801f344aa26e3f2d1ffe6f6227be6f16a2 (diff)
i2c: npcm: Fix error detection
Testing an unisgned member of a struct 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/npcm_i2c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/npcm_i2c.c b/drivers/i2c/npcm_i2c.c
index bff0d04f1a5..d57237a6df1 100644
--- a/drivers/i2c/npcm_i2c.c
+++ b/drivers/i2c/npcm_i2c.c
@@ -573,7 +573,7 @@ static int npcm_i2c_probe(struct udevice *dev)
return ret;
}
bus->apb_clk = clk_get_rate(&clk);
- if (bus->apb_clk <= 0) {
+ if (!bus->apb_clk || IS_ERR_VALUE(bus->apb_clk)) {
printf("%s: fail to get rate\n", __func__);
return -EINVAL;
}