diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-04-07 12:30:52 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-17 16:47:26 +0300 |
commit | 4dbccb873f2b35ad1b26419ff88c80509e2d4cbb (patch) | |
tree | 5e3675010c3c14baa660a0c9dd8138b442bfcd00 /drivers/platform/x86/surface3_power.c | |
parent | 8f3d9f354286745c751374f5f1fcafee6b3f3136 (diff) | |
download | linux-4dbccb873f2b35ad1b26419ff88c80509e2d4cbb.tar.xz |
platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
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>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/surface3_power.c')
-rw-r--r-- | drivers/platform/x86/surface3_power.c | 4 |
1 files 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); |