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

Commit dae6ba4a authored by Mark Brown's avatar Mark Brown Committed by Dmitry Torokhov
Browse files

Input: wm831x-on - convert to devm_kzalloc()



Saves a small amount of code and reduces the potential for leaks.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent ef8dee5c
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
	int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0));
	int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0));
	int ret;
	int ret;


	wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL);
	wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on),
				 GFP_KERNEL);
	if (!wm831x_on) {
	if (!wm831x_on) {
		dev_err(&pdev->dev, "Can't allocate data\n");
		dev_err(&pdev->dev, "Can't allocate data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -120,7 +121,6 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
err_input_dev:
err_input_dev:
	input_free_device(wm831x_on->dev);
	input_free_device(wm831x_on->dev);
err:
err:
	kfree(wm831x_on);
	return ret;
	return ret;
}
}


@@ -132,7 +132,6 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev)
	free_irq(irq, wm831x_on);
	free_irq(irq, wm831x_on);
	cancel_delayed_work_sync(&wm831x_on->work);
	cancel_delayed_work_sync(&wm831x_on->work);
	input_unregister_device(wm831x_on->dev);
	input_unregister_device(wm831x_on->dev);
	kfree(wm831x_on);


	return 0;
	return 0;
}
}