aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2012-09-05 04:40:51 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-09-07 17:01:43 -0400
commit72eac3020de35a2c3fd0d39a26399989a0a9392e (patch)
treea334304b36503fe1c88b267fc3be3d17bab30b9f /drivers/gpio
parentab3b8782618c046386b85ada5e0e789212f17cf8 (diff)
gpio: 74x164: Use devm_kzalloc
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Florian Fainelli <florian@openwrt.org> Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-74x164.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index 2975036c36b7..604b998b7b74 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -90,7 +90,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
90 if (ret < 0) 90 if (ret < 0)
91 return ret; 91 return ret;
92 92
93 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 93 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL);
94 if (!chip) 94 if (!chip)
95 return -ENOMEM; 95 return -ENOMEM;
96 96
@@ -125,7 +125,6 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
125exit_destroy: 125exit_destroy:
126 dev_set_drvdata(&spi->dev, NULL); 126 dev_set_drvdata(&spi->dev, NULL);
127 mutex_destroy(&chip->lock); 127 mutex_destroy(&chip->lock);
128 kfree(chip);
129 return ret; 128 return ret;
130} 129}
131 130
@@ -141,10 +140,9 @@ static int __devexit gen_74x164_remove(struct spi_device *spi)
141 dev_set_drvdata(&spi->dev, NULL); 140 dev_set_drvdata(&spi->dev, NULL);
142 141
143 ret = gpiochip_remove(&chip->gpio_chip); 142 ret = gpiochip_remove(&chip->gpio_chip);
144 if (!ret) { 143 if (!ret)
145 mutex_destroy(&chip->lock); 144 mutex_destroy(&chip->lock);
146 kfree(chip); 145 else
147 } else
148 dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n", 146 dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
149 ret); 147 ret);
150 148