Re: [PATCH 2/2] gpio: wm8350: Convert to use devm_kzalloc API

2012-09-04 Thread Linus Walleij
On Sun, Sep 2, 2012 at 5:58 AM, Axel Lin  wrote:

> Signed-off-by: Axel Lin 

Applied, thanks!
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] gpio: wm8350: Convert to use devm_kzalloc API

2012-09-04 Thread Linus Walleij
On Sun, Sep 2, 2012 at 5:58 AM, Axel Lin axel@gmail.com wrote:

 Signed-off-by: Axel Lin axel@gmail.com

Applied, thanks!
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] gpio: wm8350: Convert to use devm_kzalloc API

2012-09-01 Thread Axel Lin
Signed-off-by: Axel Lin 
---
 drivers/gpio/gpio-wm8350.c |   19 +--
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c
index a06af51..fb42938 100644
--- a/drivers/gpio/gpio-wm8350.c
+++ b/drivers/gpio/gpio-wm8350.c
@@ -116,7 +116,8 @@ static int __devinit wm8350_gpio_probe(struct 
platform_device *pdev)
struct wm8350_gpio_data *wm8350_gpio;
int ret;
 
-   wm8350_gpio = kzalloc(sizeof(*wm8350_gpio), GFP_KERNEL);
+   wm8350_gpio = devm_kzalloc(>dev, sizeof(*wm8350_gpio),
+  GFP_KERNEL);
if (wm8350_gpio == NULL)
return -ENOMEM;
 
@@ -131,30 +132,20 @@ static int __devinit wm8350_gpio_probe(struct 
platform_device *pdev)
 
ret = gpiochip_add(_gpio->gpio_chip);
if (ret < 0) {
-   dev_err(>dev, "Could not register gpiochip, %d\n",
-   ret);
-   goto err;
+   dev_err(>dev, "Could not register gpiochip, %d\n", ret);
+   return ret;
}
 
platform_set_drvdata(pdev, wm8350_gpio);
 
return ret;
-
-err:
-   kfree(wm8350_gpio);
-   return ret;
 }
 
 static int __devexit wm8350_gpio_remove(struct platform_device *pdev)
 {
struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev);
-   int ret;
-
-   ret = gpiochip_remove(_gpio->gpio_chip);
-   if (ret == 0)
-   kfree(wm8350_gpio);
 
-   return ret;
+   return gpiochip_remove(_gpio->gpio_chip);
 }
 
 static struct platform_driver wm8350_gpio_driver = {
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] gpio: wm8350: Convert to use devm_kzalloc API

2012-09-01 Thread Axel Lin
Signed-off-by: Axel Lin axel@gmail.com
---
 drivers/gpio/gpio-wm8350.c |   19 +--
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c
index a06af51..fb42938 100644
--- a/drivers/gpio/gpio-wm8350.c
+++ b/drivers/gpio/gpio-wm8350.c
@@ -116,7 +116,8 @@ static int __devinit wm8350_gpio_probe(struct 
platform_device *pdev)
struct wm8350_gpio_data *wm8350_gpio;
int ret;
 
-   wm8350_gpio = kzalloc(sizeof(*wm8350_gpio), GFP_KERNEL);
+   wm8350_gpio = devm_kzalloc(pdev-dev, sizeof(*wm8350_gpio),
+  GFP_KERNEL);
if (wm8350_gpio == NULL)
return -ENOMEM;
 
@@ -131,30 +132,20 @@ static int __devinit wm8350_gpio_probe(struct 
platform_device *pdev)
 
ret = gpiochip_add(wm8350_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, wm8350_gpio);
 
return ret;
-
-err:
-   kfree(wm8350_gpio);
-   return ret;
 }
 
 static int __devexit wm8350_gpio_remove(struct platform_device *pdev)
 {
struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev);
-   int ret;
-
-   ret = gpiochip_remove(wm8350_gpio-gpio_chip);
-   if (ret == 0)
-   kfree(wm8350_gpio);
 
-   return ret;
+   return gpiochip_remove(wm8350_gpio-gpio_chip);
 }
 
 static struct platform_driver wm8350_gpio_driver = {
-- 
1.7.9.5



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/