diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-15 05:16:11 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-03-27 11:05:12 -0400 |
commit | f39f54af032ce900815d0d718df5f1717eed50fe (patch) | |
tree | 61267d9ae233fbb7bb9c6637c9c13ffa70bfaa8b /drivers/gpio | |
parent | 632d8e55d1f0304579315669bfadcab7352973fd (diff) |
gpio: pcf857x: use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pcf857x.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index a965620c1c2a..e8faf53f3875 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
@@ -268,7 +268,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
268 | } | 268 | } |
269 | 269 | ||
270 | /* Allocate, initialize, and register this gpio_chip. */ | 270 | /* Allocate, initialize, and register this gpio_chip. */ |
271 | gpio = kzalloc(sizeof *gpio, GFP_KERNEL); | 271 | gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); |
272 | if (!gpio) | 272 | if (!gpio) |
273 | return -ENOMEM; | 273 | return -ENOMEM; |
274 | 274 | ||
@@ -391,7 +391,6 @@ fail: | |||
391 | if (pdata && client->irq) | 391 | if (pdata && client->irq) |
392 | pcf857x_irq_domain_cleanup(gpio); | 392 | pcf857x_irq_domain_cleanup(gpio); |
393 | 393 | ||
394 | kfree(gpio); | ||
395 | return status; | 394 | return status; |
396 | } | 395 | } |
397 | 396 | ||
@@ -416,9 +415,7 @@ static int pcf857x_remove(struct i2c_client *client) | |||
416 | pcf857x_irq_domain_cleanup(gpio); | 415 | pcf857x_irq_domain_cleanup(gpio); |
417 | 416 | ||
418 | status = gpiochip_remove(&gpio->chip); | 417 | status = gpiochip_remove(&gpio->chip); |
419 | if (status == 0) | 418 | if (status) |
420 | kfree(gpio); | ||
421 | else | ||
422 | dev_err(&client->dev, "%s --> %d\n", "remove", status); | 419 | dev_err(&client->dev, "%s --> %d\n", "remove", status); |
423 | return status; | 420 | return status; |
424 | } | 421 | } |