summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/i2c-multi-instantiate.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-11-28 12:45:23 +0100
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-12-03 20:40:01 +0100
commit41daf985820c72b6768512943dab23f5f41ef865 (patch)
treea6a52deef0770db36f38d818a227a66f3f98d6bd /drivers/platform/x86/i2c-multi-instantiate.c
parentplatform/x86: intel_cht_int33fe: Accept errors of i2c_acpi_new_device() (diff)
downloadlinux-41daf985820c72b6768512943dab23f5f41ef865.tar.xz
linux-41daf985820c72b6768512943dab23f5f41ef865.zip
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/x86/i2c-multi-instantiate.c')
-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;
}
}