aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-05 12:22:09 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-07-12 07:40:14 -0400
commitf8d203c049af2faaa4a23e51e1626b7660b33d8e (patch)
tree84fe62e06184411165c170ac641a07aabfaaa4c7 /drivers/gpio
parent224a1f90458b5005fa7aec5e8a6d64fd8eccb208 (diff)
gpiolib: wm8994: Convert to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-wm8994.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index a1c7ba94b523..f2b3d19dd7a9 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -249,7 +249,8 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
249 struct wm8994_gpio *wm8994_gpio; 249 struct wm8994_gpio *wm8994_gpio;
250 int ret; 250 int ret;
251 251
252 wm8994_gpio = kzalloc(sizeof(*wm8994_gpio), GFP_KERNEL); 252 wm8994_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8994_gpio),
253 GFP_KERNEL);
253 if (wm8994_gpio == NULL) 254 if (wm8994_gpio == NULL)
254 return -ENOMEM; 255 return -ENOMEM;
255 256
@@ -274,20 +275,14 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
274 return ret; 275 return ret;
275 276
276err: 277err:
277 kfree(wm8994_gpio);
278 return ret; 278 return ret;
279} 279}
280 280
281static int __devexit wm8994_gpio_remove(struct platform_device *pdev) 281static int __devexit wm8994_gpio_remove(struct platform_device *pdev)
282{ 282{
283 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev); 283 struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev);
284 int ret;
285
286 ret = gpiochip_remove(&wm8994_gpio->gpio_chip);
287 if (ret == 0)
288 kfree(wm8994_gpio);
289 284
290 return ret; 285 return gpiochip_remove(&wm8994_gpio->gpio_chip);
291} 286}
292 287
293static struct platform_driver wm8994_gpio_driver = { 288static struct platform_driver wm8994_gpio_driver = {