aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-wm8350.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-09-01 23:58:59 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-09-04 03:26:06 -0400
commit5b4254386bf9a96dfcef9ec8e099bd06fe3e6896 (patch)
tree71a1fa3ff238a115a7c582e6d2cd595a9101a582 /drivers/gpio/gpio-wm8350.c
parent718bc6e33f33914690ba1b757de2327da7522a87 (diff)
gpio: wm8350: 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-wm8350.c')
-rw-r--r--drivers/gpio/gpio-wm8350.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c
index a06af5154838..fb4293889392 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)
116 struct wm8350_gpio_data *wm8350_gpio; 116 struct wm8350_gpio_data *wm8350_gpio;
117 int ret; 117 int ret;
118 118
119 wm8350_gpio = kzalloc(sizeof(*wm8350_gpio), GFP_KERNEL); 119 wm8350_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm8350_gpio),
120 GFP_KERNEL);
120 if (wm8350_gpio == NULL) 121 if (wm8350_gpio == NULL)
121 return -ENOMEM; 122 return -ENOMEM;
122 123
@@ -131,30 +132,20 @@ static int __devinit wm8350_gpio_probe(struct platform_device *pdev)
131 132
132 ret = gpiochip_add(&wm8350_gpio->gpio_chip); 133 ret = gpiochip_add(&wm8350_gpio->gpio_chip);
133 if (ret < 0) { 134 if (ret < 0) {
134 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", 135 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
135 ret); 136 return ret;
136 goto err;
137 } 137 }
138 138
139 platform_set_drvdata(pdev, wm8350_gpio); 139 platform_set_drvdata(pdev, wm8350_gpio);
140 140
141 return ret; 141 return ret;
142
143err:
144 kfree(wm8350_gpio);
145 return ret;
146} 142}
147 143
148static int __devexit wm8350_gpio_remove(struct platform_device *pdev) 144static int __devexit wm8350_gpio_remove(struct platform_device *pdev)
149{ 145{
150 struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev); 146 struct wm8350_gpio_data *wm8350_gpio = platform_get_drvdata(pdev);
151 int ret;
152
153 ret = gpiochip_remove(&wm8350_gpio->gpio_chip);
154 if (ret == 0)
155 kfree(wm8350_gpio);
156 147
157 return ret; 148 return gpiochip_remove(&wm8350_gpio->gpio_chip);
158} 149}
159 150
160static struct platform_driver wm8350_gpio_driver = { 151static struct platform_driver wm8350_gpio_driver = {