aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-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 = {