Skip to content

Commit 7f2e65a

Browse files
harshimogalapalliwsakernel
authored andcommitted
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: 605efbf ("i2c: qcom-cci: Use dev_err_probe in probe function") Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 6c30ac9 commit 7f2e65a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/busses/i2c-qcom-cci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,10 @@ static int cci_probe(struct platform_device *pdev)
588588
/* Clocks */
589589

590590
ret = devm_clk_bulk_get_all(dev, &cci->clocks);
591-
if (ret < 1)
591+
if (ret < 0)
592592
return dev_err_probe(dev, ret, "failed to get clocks\n");
593+
else if (!ret)
594+
return dev_err_probe(dev, -EINVAL, "not enough clocks in DT\n");
593595
cci->nclocks = ret;
594596

595597
/* Retrieve CCI clock rate */

0 commit comments

Comments
 (0)