diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-09-01 05:34:15 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-09-01 06:53:56 -0400 |
commit | eb7cf95a55a0d737e5f5694e71f65966a1c4e7aa (patch) | |
tree | f51b9cd3dbd91bbf1669daab9e75d61710216659 /drivers/gpio | |
parent | 6ab49f4201676a96f62d0f327206a28dc02f2e2f (diff) |
gpio: da9052: 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')
-rw-r--r-- | drivers/gpio/gpio-da9052.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 56dd047d5844..24b8c2974047 100644 --- a/drivers/gpio/gpio-da9052.c +++ b/drivers/gpio/gpio-da9052.c | |||
@@ -207,7 +207,7 @@ static int __devinit da9052_gpio_probe(struct platform_device *pdev) | |||
207 | struct da9052_pdata *pdata; | 207 | struct da9052_pdata *pdata; |
208 | int ret; | 208 | int ret; |
209 | 209 | ||
210 | gpio = kzalloc(sizeof(*gpio), GFP_KERNEL); | 210 | gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); |
211 | if (gpio == NULL) | 211 | if (gpio == NULL) |
212 | return -ENOMEM; | 212 | return -ENOMEM; |
213 | 213 | ||
@@ -221,28 +221,19 @@ static int __devinit da9052_gpio_probe(struct platform_device *pdev) | |||
221 | ret = gpiochip_add(&gpio->gp); | 221 | ret = gpiochip_add(&gpio->gp); |
222 | if (ret < 0) { | 222 | if (ret < 0) { |
223 | dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); | 223 | dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); |
224 | goto err_mem; | 224 | return ret; |
225 | } | 225 | } |
226 | 226 | ||
227 | platform_set_drvdata(pdev, gpio); | 227 | platform_set_drvdata(pdev, gpio); |
228 | 228 | ||
229 | return 0; | 229 | return 0; |
230 | |||
231 | err_mem: | ||
232 | kfree(gpio); | ||
233 | return ret; | ||
234 | } | 230 | } |
235 | 231 | ||
236 | static int __devexit da9052_gpio_remove(struct platform_device *pdev) | 232 | static int __devexit da9052_gpio_remove(struct platform_device *pdev) |
237 | { | 233 | { |
238 | struct da9052_gpio *gpio = platform_get_drvdata(pdev); | 234 | struct da9052_gpio *gpio = platform_get_drvdata(pdev); |
239 | int ret; | ||
240 | |||
241 | ret = gpiochip_remove(&gpio->gp); | ||
242 | if (ret == 0) | ||
243 | kfree(gpio); | ||
244 | 235 | ||
245 | return ret; | 236 | return gpiochip_remove(&gpio->gp); |
246 | } | 237 | } |
247 | 238 | ||
248 | static struct platform_driver da9052_gpio_driver = { | 239 | static struct platform_driver da9052_gpio_driver = { |