From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Darren Hart" <dvhart@infradead.org>, "Blaž Hrastnik" <blaz@mxxn.io>
Cc: Andy Shevchenko <andy@infradead.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Stephen Just <stephenjust@gmail.com>,
platform-driver-x86@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
Date: Tue, 7 Apr 2020 12:30:52 +0300 [thread overview]
Message-ID: <20200407093052.GL68494@mwanda> (raw)
The i2c_acpi_new_device() function never returns NULL, it returns error
pointers.
Fixes: b1f81b496b0d ("platform/x86: surface3_power: MSHW0011 rev-eng implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/platform/x86/surface3_power.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/surface3_power.c b/drivers/platform/x86/surface3_power.c
index 946ac2dc08ae..cc4f9cba6856 100644
--- a/drivers/platform/x86/surface3_power.c
+++ b/drivers/platform/x86/surface3_power.c
@@ -522,8 +522,8 @@ static int mshw0011_probe(struct i2c_client *client)
strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
bat0 = i2c_acpi_new_device(dev, 1, &board_info);
- if (!bat0)
- return -ENOMEM;
+ if (IS_ERR(bat0))
+ return PTR_ERR(bat0);
data->bat0 = bat0;
i2c_set_clientdata(bat0, data);
--
2.25.1
next reply other threads:[~2020-04-07 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-07 9:30 Dan Carpenter [this message]
2020-04-17 13:40 ` [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe Andy Shevchenko
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=20200407093052.GL68494@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andy@infradead.org \
--cc=benjamin.tissoires@redhat.com \
--cc=blaz@mxxn.io \
--cc=dvhart@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stephenjust@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