]> git.baikalelectronics.ru Git - kernel.git/commitdiff
platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 7 Apr 2020 09:30:52 +0000 (12:30 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 17 Apr 2020 13:47:26 +0000 (16:47 +0300)
The i2c_acpi_new_device() function never returns NULL, it returns error
pointers.

Fixes: 6580d28324e7 ("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>
drivers/platform/x86/surface3_power.c

index 946ac2dc08ae7c3e2691b47d5f09594368440144..cc4f9cba68563c137c1c71785e8d6c26479ef2c6 100644 (file)
@@ -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);