Message ID | 20171111050231.29047-3-andi@etezian.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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;
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@etezian.org> --- drivers/input/touchscreen/ili210x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)