linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
	<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: [PATCH -next] extcon: ptn5150: Fix return value check in ptn5150_i2c_probe()
Date: Fri, 25 Jan 2019 01:45:54 +0000	[thread overview]
Message-ID: <1548380754-67031-1-git-send-email-weiyongjun1@huawei.com> (raw)

In case of error, the function devm_gpiod_get() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Fixes: 58963276749e ("extcon: Add support for ptn5150 extcon driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/extcon/extcon-ptn5150.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
index 155620b..8217fdc 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -240,14 +240,14 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c,
 	info->dev = &i2c->dev;
 	info->i2c = i2c;
 	info->int_gpiod = devm_gpiod_get(&i2c->dev, "int", GPIOD_IN);
-	if (!info->int_gpiod) {
+	if (IS_ERR(info->int_gpiod)) {
 		dev_err(dev, "failed to get INT GPIO\n");
-		return -EINVAL;
+		return PTR_ERR(info->int_gpiod);
 	}
 	info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_IN);
-	if (!info->vbus_gpiod) {
+	if (IS_ERR(info->vbus_gpiod)) {
 		dev_err(dev, "failed to get VBUS GPIO\n");
-		return -EINVAL;
+		return PTR_ERR(info->vbus_gpiod);
 	}
 	ret = gpiod_direction_output(info->vbus_gpiod, 0);
 	if (ret) {




                 reply	other threads:[~2019-01-25  1:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1548380754-67031-1-git-send-email-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=cw00.choi@samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=vijaikumar.kanagarajan@gmail.com \
    /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).