forked from Minki/linux
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>
This commit is contained in:
parent
ff0b3cd4a4
commit
7b9bb6d8cf
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user