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: 605efbf438 ("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>
This commit is contained in:
Harshit Mogalapalli 2023-08-23 12:42:02 -07:00 committed by Wolfram Sang
parent 6c30ac917a
commit 7f2e65a8f5

View file

@ -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 */