summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-03-15 18:15:49 +0900
committerLinus Walleij <linus.walleij@linaro.org>2013-03-27 16:05:12 +0100
commit632d8e55d1f0304579315669bfadcab7352973fd (patch)
tree1ff526a6c6d2f26a44461651aad8f4cb30153c58 /drivers/gpio
parentb09638a4d6b8032f6569e6ec8a5cc373ced045aa (diff)
downloadlinux-632d8e55d1f0304579315669bfadcab7352973fd.tar.gz
linux-632d8e55d1f0304579315669bfadcab7352973fd.tar.bz2
linux-632d8e55d1f0304579315669bfadcab7352973fd.zip
gpio: mc33880: 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-mc33880.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index 6a8fdc26ae6a..b16148913a78 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -101,7 +101,7 @@ static int mc33880_probe(struct spi_device *spi)
if (ret < 0)
return ret;
- mc = kzalloc(sizeof(struct mc33880), GFP_KERNEL);
+ mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL);
if (!mc)
return -ENOMEM;
@@ -143,7 +143,6 @@ static int mc33880_probe(struct spi_device *spi)
exit_destroy:
dev_set_drvdata(&spi->dev, NULL);
mutex_destroy(&mc->lock);
- kfree(mc);
return ret;
}
@@ -159,10 +158,9 @@ static int mc33880_remove(struct spi_device *spi)
dev_set_drvdata(&spi->dev, NULL);
ret = gpiochip_remove(&mc->chip);
- if (!ret) {
+ if (!ret)
mutex_destroy(&mc->lock);
- kfree(mc);
- } else
+ else
dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
ret);