From: Andi Shyti <andi@etezian.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Andi Shyti <andi@etezian.org>, Andi Shyti <andi.shyti@gmail.com>
Subject: [PATCH 2/2] Input: ili210x - use separate error handling for different allocators
Date: Sat, 11 Nov 2017 07:02:31 +0200 [thread overview]
Message-ID: <20171111050231.29047-3-andi@etezian.org> (raw)
In-Reply-To: <20171111050231.29047-1-andi@etezian.org>
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(-)
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
prev parent reply other threads:[~2017-11-11 5:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-11 5:02 [PATCH 0/2] managed resources for ili210x Andi Shyti
2017-11-11 5:02 ` [PATCH 1/2] Input: ili210x - use managed allocated resources Andi Shyti
2017-11-11 5:02 ` Andi Shyti [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171111050231.29047-3-andi@etezian.org \
--to=andi@etezian.org \
--cc=andi.shyti@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).