Skip to content

Commit 0300c81

Browse files
hiss2018gregkh
authored andcommitted
mfd: htc-i2cpld: Add the missed i2c_put_adapter() in htcpld_register_chip_i2c()
[ Upstream commit 9a46328 ] htcpld_register_chip_i2c() misses to call i2c_put_adapter() in an error path. Add the missed function call to fix it. Fixes: 6048a3d ("mfd: Add HTCPLD driver") Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3e377bb commit 0300c81

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/mfd/htc-i2cpld.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ static int htcpld_register_chip_i2c(
346346
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
347347
dev_warn(dev, "i2c adapter %d non-functional\n",
348348
pdata->i2c_adapter_id);
349+
i2c_put_adapter(adapter);
349350
return -EINVAL;
350351
}
351352

@@ -360,6 +361,7 @@ static int htcpld_register_chip_i2c(
360361
/* I2C device registration failed, contineu with the next */
361362
dev_warn(dev, "Unable to add I2C device for 0x%x\n",
362363
plat_chip_data->addr);
364+
i2c_put_adapter(adapter);
363365
return PTR_ERR(client);
364366
}
365367

0 commit comments

Comments
 (0)