[PATCH 2/2] Input: ili210x - use separate error handling for different allocators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux