Skip to content

Commit

Permalink
platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
Browse files Browse the repository at this point in the history
The i2c_acpi_new_device() function never returns NULL, it returns error
pointers.

Fixes: b1f81b4 ("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>
  • Loading branch information
Dan Carpenter authored and Andy Shevchenko committed Apr 17, 2020
1 parent 8f3d9f3 commit 4dbccb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/platform/x86/surface3_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4dbccb8

Please sign in to comment.