Skip to content

Commit

Permalink
mfd: 88pm860x: Fix I2C device resource leak on regmap init fail
Browse files Browse the repository at this point in the history
During probe the driver allocates dummy I2C device for companion chip
and then allocates a regmap for it. If regmap_init_i2c() fails then the
I2C driver (allocated with i2c_new_dummy()) is not freed and this
resource leaks.

Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Krzysztof Kozlowski authored and Lee Jones committed Mar 19, 2014
1 parent 96cf3de commit a7ab1c8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/mfd/88pm860x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ static int pm860x_probe(struct i2c_client *client,
ret = PTR_ERR(chip->regmap_companion);
dev_err(&chip->companion->dev,
"Failed to allocate register map: %d\n", ret);
i2c_unregister_device(chip->companion);
return ret;
}
i2c_set_clientdata(chip->companion, chip);
Expand Down

0 comments on commit a7ab1c8

Please sign in to comment.