i2c: qcom-cci: don't delete an unregistered adapter

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: e517526195 ("i2c: Add Qualcomm CCI I2C driver")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Vladimir Zapolskiy 2022-02-03 18:47:00 +02:00 committed by Wolfram Sang
parent 9495b9b31a
commit a0d48505a1

View File

@ -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);
}