summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>2023-08-23 22:42:02 +0300
committerWolfram Sang <wsa@kernel.org>2023-08-25 23:07:10 +0300
commit7f2e65a8f546a0b1e5fd0770c802c5e4af9cf14e (patch)
tree218e0c1e168cacb579ddb549827a10d5587d78cd
parent6c30ac917a4665321dafbeb2d9ccfde59522dfe2 (diff)
downloadlinux-7f2e65a8f546a0b1e5fd0770c802c5e4af9cf14e.tar.xz
i2c: qcom-cci: Fix error checking in cci_probe()
devm_clk_bulk_get_all() can return zero when no clocks are obtained. Passing zero to dev_err_probe() is a success which is incorrect. Fixes: 605efbf43813 ("i2c: qcom-cci: Use dev_err_probe in probe function") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
-rw-r--r--drivers/i2c/busses/i2c-qcom-cci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index cf13abec05f1..414882c57d7f 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -588,8 +588,10 @@ static int cci_probe(struct platform_device *pdev)
/* Clocks */
ret = devm_clk_bulk_get_all(dev, &cci->clocks);
- if (ret < 1)
+ if (ret < 0)
return dev_err_probe(dev, ret, "failed to get clocks\n");
+ else if (!ret)
+ return dev_err_probe(dev, -EINVAL, "not enough clocks in DT\n");
cci->nclocks = ret;
/* Retrieve CCI clock rate */