diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-14 13:23:19 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2012-01-06 09:24:00 -0500 |
commit | 7b9bb6d8cfe80580329318caf6c3a137762ecea3 (patch) | |
tree | 22dcfd25e36c1a1f1317bfc15ce0db7f78a2f40e /drivers | |
parent | ff0b3cd4a416bc727b0797b95b229b278d2a28f2 (diff) |
watchdog: Convert wm831x driver to devm_kzalloc()
Saves a small amount of code and systematically eliminates leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/watchdog/wm831x_wdt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 6cd1ba41b47c..263c883f0806 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -199,7 +199,8 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev) | |||
199 | if (reg & WM831X_WDOG_DEBUG) | 199 | if (reg & WM831X_WDOG_DEBUG) |
200 | dev_warn(wm831x->dev, "Watchdog is paused\n"); | 200 | dev_warn(wm831x->dev, "Watchdog is paused\n"); |
201 | 201 | ||
202 | driver_data = kzalloc(sizeof(*driver_data), GFP_KERNEL); | 202 | driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data), |
203 | GFP_KERNEL); | ||
203 | if (!driver_data) { | 204 | if (!driver_data) { |
204 | dev_err(wm831x->dev, "Unable to alloacate watchdog device\n"); | 205 | dev_err(wm831x->dev, "Unable to alloacate watchdog device\n"); |
205 | ret = -ENOMEM; | 206 | ret = -ENOMEM; |
@@ -250,7 +251,7 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev) | |||
250 | dev_err(wm831x->dev, | 251 | dev_err(wm831x->dev, |
251 | "Failed to request update GPIO: %d\n", | 252 | "Failed to request update GPIO: %d\n", |
252 | ret); | 253 | ret); |
253 | goto err_alloc; | 254 | goto err; |
254 | } | 255 | } |
255 | 256 | ||
256 | ret = gpio_direction_output(pdata->update_gpio, 0); | 257 | ret = gpio_direction_output(pdata->update_gpio, 0); |
@@ -292,8 +293,6 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev) | |||
292 | err_gpio: | 293 | err_gpio: |
293 | if (driver_data->update_gpio) | 294 | if (driver_data->update_gpio) |
294 | gpio_free(driver_data->update_gpio); | 295 | gpio_free(driver_data->update_gpio); |
295 | err_alloc: | ||
296 | kfree(driver_data); | ||
297 | err: | 296 | err: |
298 | return ret; | 297 | return ret; |
299 | } | 298 | } |