Skip to content

Commit 4dbccb8

Browse files
Dan Carpenterandy-shev
authored andcommitted
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: b1f81b4 ("platform/x86: surface3_power: MSHW0011 rev-eng implementation") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 8f3d9f3 commit 4dbccb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/x86/surface3_power.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ static int mshw0011_probe(struct i2c_client *client)
522522
strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
523523

524524
bat0 = i2c_acpi_new_device(dev, 1, &board_info);
525-
if (!bat0)
526-
return -ENOMEM;
525+
if (IS_ERR(bat0))
526+
return PTR_ERR(bat0);
527527

528528
data->bat0 = bat0;
529529
i2c_set_clientdata(bat0, data);

0 commit comments

Comments
 (0)