[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 Nov 2017 07:02:31 +0200
From: Andi Shyti <andi@...zian.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Andi Shyti <andi@...zian.org>,
Andi Shyti <andi.shyti@...il.com>
Subject: [PATCH 2/2] Input: ili210x - use separate error handling for different allocators
Split the error between devm_kzalloc and
devm_input_allocate_device, there is no need to call the second
allocator if the first has failed. Besides this doesn't provide
practical advantages.
Signed-off-by: Andi Shyti <andi@...zian.org>
---
drivers/input/touchscreen/ili210x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index da868b1d0e83..9344c4436430 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -225,8 +225,11 @@ static int ili210x_i2c_probe(struct i2c_client *client,
ymax = panel.finger_max.y_low | (panel.finger_max.y_high << 8);
priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
input = devm_input_allocate_device(&client->dev);
- if (!priv || !input)
+ if (!input)
return -ENOMEM;
priv->client = client;
--
2.15.0
Powered by blists - more mailing lists