diff mbox series

[3/9] i2c: qcom-cci: don't delete an unregistered adapter

Message ID 20220203164700.1711985-1-vladimir.zapolskiy@linaro.org
State Accepted
Commit a0d48505a1d68e27220369e2dd1e3573a2f362d2
Headers show
Series i2c: qcom-cci: fixes and updates | expand

Commit Message

Vladimir Zapolskiy Feb. 3, 2022, 4:47 p.m. UTC
If i2c_add_adapter() fails to add an I2C adapter found on QCOM CCI
controller, on error path i2c_del_adapter() is still called.

Fortunately there is a sanity check in the I2C core, so the only
visible implication is a printed debug level message:

    i2c-core: attempting to delete unregistered adapter [Qualcomm-CCI]

Nevertheless it would be reasonable to correct the probe error path.

Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Feb. 11, 2022, 5:43 p.m. UTC | #1
On Thu, Feb 03, 2022 at 06:47:00PM +0200, Vladimir Zapolskiy wrote:
> If i2c_add_adapter() fails to add an I2C adapter found on QCOM CCI
> controller, on error path i2c_del_adapter() is still called.
> 
> Fortunately there is a sanity check in the I2C core, so the only
> visible implication is a printed debug level message:
> 
>     i2c-core: attempting to delete unregistered adapter [Qualcomm-CCI]
> 
> Nevertheless it would be reasonable to correct the probe error path.
> 
> Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>

Applied to for-current, thanks!
Wolfram Sang Feb. 11, 2022, 5:45 p.m. UTC | #2
> Fixes like this should either come first in the series, or be sent on
> their own, as it could be merged without considering the remainder of
> the series

True. Luckily, I found the two fixes and applied them.
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index c1de8eb66169..fd4260d18577 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -655,7 +655,7 @@  static int cci_probe(struct platform_device *pdev)
 	return 0;
 
 error_i2c:
-	for (; i >= 0; i--) {
+	for (--i ; i >= 0; i--) {
 		if (cci->master[i].cci)
 			i2c_del_adapter(&cci->master[i].adap);
 	}