diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-09-02 11:58:07 +0800 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-09-04 09:25:13 +0200 |
commit | 718bc6e33f33914690ba1b757de2327da7522a87 (patch) | |
tree | 67c9808e15d950a5989e7e465e39c45e66ea9ac3 /drivers/gpio/gpio-wm831x.c | |
parent | c8554d32483ef543b9ad3e4349c8d80ea625dc04 (diff) | |
download | linux-3.10-718bc6e33f33914690ba1b757de2327da7522a87.tar.gz linux-3.10-718bc6e33f33914690ba1b757de2327da7522a87.tar.bz2 linux-3.10-718bc6e33f33914690ba1b757de2327da7522a87.zip |
gpio: wm831x: Convert to use devm_kzalloc API
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-wm831x.c')
-rw-r--r-- | drivers/gpio/gpio-wm831x.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c index e56a2165641..b6eda35089d 100644 --- a/drivers/gpio/gpio-wm831x.c +++ b/drivers/gpio/gpio-wm831x.c @@ -250,7 +250,8 @@ static int __devinit wm831x_gpio_probe(struct platform_device *pdev) struct wm831x_gpio *wm831x_gpio; int ret; - wm831x_gpio = kzalloc(sizeof(*wm831x_gpio), GFP_KERNEL); + wm831x_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm831x_gpio), + GFP_KERNEL); if (wm831x_gpio == NULL) return -ENOMEM; @@ -265,30 +266,20 @@ static int __devinit wm831x_gpio_probe(struct platform_device *pdev) ret = gpiochip_add(&wm831x_gpio->gpio_chip); if (ret < 0) { - dev_err(&pdev->dev, "Could not register gpiochip, %d\n", - ret); - goto err; + dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); + return ret; } platform_set_drvdata(pdev, wm831x_gpio); return ret; - -err: - kfree(wm831x_gpio); - return ret; } static int __devexit wm831x_gpio_remove(struct platform_device *pdev) { struct wm831x_gpio *wm831x_gpio = platform_get_drvdata(pdev); - int ret; - - ret = gpiochip_remove(&wm831x_gpio->gpio_chip); - if (ret == 0) - kfree(wm831x_gpio); - return ret; + return gpiochip_remove(&wm831x_gpio->gpio_chip); } static struct platform_driver wm831x_gpio_driver = { |