diff mbox series

[2/8] input: touchscreen: ili210x: Convert to devm_ functions

Message ID 20181213151442.27854-3-marex@denx.de (mailing list archive)
State Superseded
Headers show
Series input: touchscreen: ili210x: Add ILI2511 support | expand

Commit Message

Marek Vasut Dec. 13, 2018, 3:14 p.m. UTC
Convert the driver to dev-managed allocations.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: Olivier Sobrie <olivier@sobrie.be>
To: linux-input@vger.kernel.org
---
 drivers/input/touchscreen/ili210x.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 25b0ca6c07d9b..7ba93de712432 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -217,12 +217,10 @@  static int ili210x_i2c_probe(struct i2c_client *client,
 	xmax = panel.finger_max.x_low | (panel.finger_max.x_high << 8);
 	ymax = panel.finger_max.y_low | (panel.finger_max.y_high << 8);
 
-	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-	input = input_allocate_device();
-	if (!priv || !input) {
-		error = -ENOMEM;
-		goto err_free_mem;
-	}
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	input = devm_input_allocate_device(dev);
+	if (!priv || !input)
+		return -ENOMEM;
 
 	priv->client = client;
 	priv->input = input;
@@ -284,8 +282,6 @@  static int ili210x_i2c_probe(struct i2c_client *client,
 err_free_irq:
 	free_irq(client->irq, priv);
 err_free_mem:
-	input_free_device(input);
-	kfree(priv);
 	return error;
 }
 
@@ -297,7 +293,6 @@  static int ili210x_i2c_remove(struct i2c_client *client)
 	free_irq(priv->client->irq, priv);
 	cancel_delayed_work_sync(&priv->dwork);
 	input_unregister_device(priv->input);
-	kfree(priv);
 
 	return 0;
 }