summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-11-28 14:45:23 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-12-03 22:40:01 +0300
commit41daf985820c72b6768512943dab23f5f41ef865 (patch)
treea6a52deef0770db36f38d818a227a66f3f98d6bd /drivers/platform
parent5ae9ce13261490e0c65d7012c366bdd3cc9e2d77 (diff)
downloadlinux-41daf985820c72b6768512943dab23f5f41ef865.tar.xz
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>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/i2c-multi-instantiate.c9
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;
}
}