Skip to contentSkip to conversation

mfd: htc-i2cpld: Add the missed i2c_put_adapter() in htcpld_register_chip_i2c()

PATCH Superseded Jing Xiangfeng 1 participant 2 messages Nov 4, 2020 – Nov 6, 2020 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: htc-i2cpld: Add the missed i2c_put_adapter() in htcpld_register_chip_i2c()

htcpld_register_chip_i2c() misses to call i2c_put_adapter() in an error path. Add the missed function call to fix it.

---
 drivers/mfd/htc-i2cpld.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/htc-i2cpld.c +2 -0
index 247f9849e54a..417b0355d904 100644
@@ -346,6 +346,7 @@ static int htcpld_register_chip_i2c(
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
 		dev_warn(dev, "i2c adapter %d non-functional\n",
 			 pdata->i2c_adapter_id);
+		i2c_put_adapter(adapter);
 		return -EINVAL;
 	}
 
@@ -360,6 +361,7 @@ static int htcpld_register_chip_i2c(
 		/* I2C device registration failed, contineu with the next */
 		dev_warn(dev, "Unable to add I2C device for 0x%x\n",
 			 plat_chip_data->addr);
+		i2c_put_adapter(adapter);
 		return PTR_ERR(client);
 	}
 
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Markus Elfring
Quoted 2 lines

htcpld_register_chip_i2c() misses to call i2c_put_adapter() in an error path. Add the missed function call to fix it.

Would you like to add the tag “Fixes”?

OK, I'll send a v2 with it.

Thanks

Quoted 5 lines

Regards,
Markus
.