Skip to content

Commit

Permalink
mfd: htc-i2cpld: Add the missed i2c_put_adapter() in htcpld_register_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
hiss2018 authored and gregkh committed Dec 30, 2020
1 parent 3e377bb commit 0300c81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/mfd/htc-i2cpld.c
Expand Up @@ -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;
}

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

Expand Down

0 comments on commit 0300c81

Please sign in to comment.