diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-15 02:23:19 +0800 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2012-01-06 15:24:00 +0100 |
commit | 7b9bb6d8cfe80580329318caf6c3a137762ecea3 (patch) | |
tree | 22dcfd25e36c1a1f1317bfc15ce0db7f78a2f40e /drivers/watchdog | |
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/watchdog')
-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 6cd1ba41b47..263c883f080 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) if (reg & WM831X_WDOG_DEBUG) dev_warn(wm831x->dev, "Watchdog is paused\n"); - driver_data = kzalloc(sizeof(*driver_data), GFP_KERNEL); + driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data), + GFP_KERNEL); if (!driver_data) { dev_err(wm831x->dev, "Unable to alloacate watchdog device\n"); ret = -ENOMEM; @@ -250,7 +251,7 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev) dev_err(wm831x->dev, "Failed to request update GPIO: %d\n", ret); - goto err_alloc; + goto err; } ret = gpio_direction_output(pdata->update_gpio, 0); @@ -292,8 +293,6 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev) err_gpio: if (driver_data->update_gpio) gpio_free(driver_data->update_gpio); -err_alloc: - kfree(driver_data); err: return ret; } |