* [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
@ 2020-04-07 9:30 Dan Carpenter
2020-04-17 13:40 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-04-07 9:30 UTC (permalink / raw)
To: Darren Hart, Blaž Hrastnik
Cc: Andy Shevchenko, Benjamin Tissoires, Stephen Just,
platform-driver-x86, kernel-janitors
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
2020-04-07 9:30 [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
@ 2020-04-17 13:40 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2020-04-17 13:40 UTC (permalink / raw)
To: Dan Carpenter
Cc: Darren Hart, Blaž Hrastnik, Andy Shevchenko,
Benjamin Tissoires, Stephen Just, Platform Driver,
kernel-janitors
On Tue, Apr 7, 2020 at 12:33 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The i2c_acpi_new_device() function never returns NULL, it returns error
> pointers.
>
Pushed to my review and testing queue, thanks!
> 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
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-17 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 9:30 [PATCH] platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
2020-04-17 13:40 ` Andy Shevchenko
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).