Skip to content

Commit

Permalink
gpiolib: wm8994: Convert to devm_kzalloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Mark Brown authored and Linus Walleij committed Jul 12, 2012
1 parent 224a1f9 commit f8d203c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/gpio/gpio-wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
struct wm8994_gpio *wm8994_gpio;
int ret;

wm8994_gpio = kzalloc(sizeof(*wm8994_gpio), GFP_KERNEL);
wm8994_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8994_gpio),
GFP_KERNEL);
if (wm8994_gpio == NULL)
return -ENOMEM;

Expand All @@ -274,20 +275,14 @@ static int __devinit wm8994_gpio_probe(struct platform_device *pdev)
return ret;

err:
kfree(wm8994_gpio);
return ret;
}

static int __devexit wm8994_gpio_remove(struct platform_device *pdev)
{
struct wm8994_gpio *wm8994_gpio = platform_get_drvdata(pdev);
int ret;

ret = gpiochip_remove(&wm8994_gpio->gpio_chip);
if (ret == 0)
kfree(wm8994_gpio);

return ret;
return gpiochip_remove(&wm8994_gpio->gpio_chip);
}

static struct platform_driver wm8994_gpio_driver = {
Expand Down

0 comments on commit f8d203c

Please sign in to comment.