Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b9bb6d8 authored by Mark Brown's avatar Mark Brown Committed by Wim Van Sebroeck
Browse files

watchdog: Convert wm831x driver to devm_kzalloc()



Saves a small amount of code and systematically eliminates leaks.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent ff0b3cd4
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
}