Skip to content

Commit

Permalink
gpio: max732x: Fix I2C dummy device resource leak on probe failure
Browse files Browse the repository at this point in the history
In max732x_probe() driver allocates dummy I2C device (if number of ports
is greater than 8) however it is not unregistered if probe fails later.
Fix the leak by unregistering dummy I2C device if it was allocated.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Krzysztof Kozlowski authored and Linus Walleij committed Mar 12, 2014
1 parent 49e1f91 commit c75793d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-max732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@ static int max732x_probe(struct i2c_client *client,
return 0;

out_failed:
if (chip->client_dummy)
i2c_unregister_device(chip->client_dummy);
max732x_irq_teardown(chip);
return ret;
}
Expand Down

0 comments on commit c75793d

Please sign in to comment.