diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-11-28 13:45:23 +0200 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-12-03 21:40:01 +0200 |
commit | 41daf985820c72b6768512943dab23f5f41ef865 (patch) | |
tree | a6a52deef0770db36f38d818a227a66f3f98d6bd | |
parent | 5ae9ce13261490e0c65d7012c366bdd3cc9e2d77 (diff) | |
download | linux-41daf985820c72b6768512943dab23f5f41ef865.tar.bz2 |
platform/x86: i2c-multi-instantiate: Accept errors of i2c_acpi_new_device()
In the future i2c_acpi_new_device() will return error pointer in some cases.
Prepare i2c-multi-instantiate driver to support that.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | drivers/platform/x86/i2c-multi-instantiate.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/i2c-multi-instantiate.c index 5456581b473c..e3345da82c84 100644 --- a/drivers/platform/x86/i2c-multi-instantiate.c +++ b/drivers/platform/x86/i2c-multi-instantiate.c @@ -72,9 +72,14 @@ static int i2c_multi_inst_probe(struct platform_device *pdev) board_info.irq = ret; } multi->clients[i] = i2c_acpi_new_device(dev, i, &board_info); - if (!multi->clients[i]) { - dev_err(dev, "Error creating i2c-client, idx %d\n", i); + if (IS_ERR(multi->clients[i])) + ret = PTR_ERR(multi->clients[i]); + else if (!multi->clients[i]) ret = -ENODEV; + else + ret = 0; + if (ret) { + dev_err(dev, "Error creating i2c-client, idx %d\n", i); goto error; } } |