Theoretically the name can be invalid if device has an ACPI handle
but hadn't been matched via ACPI ID table. This should never happen,
but let's make code very slightly more robust as some other drivers do.
Fixes: dc4ecaf21c4a ("staging: iio: light: isl29018: add ACPI support")
Depends-on: 14686836fb69 ("iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/light/isl29018.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c
index cbe34026bda6..938fc19cfe59 100644
--- a/drivers/iio/light/isl29018.c
+++ b/drivers/iio/light/isl29018.c
@@ -723,6 +723,8 @@ static int isl29018_probe(struct i2c_client *client)
name = iio_get_acpi_device_name_and_data(&client->dev, &ddata);
dev_id = (intptr_t)ddata;
}
+ if (!name)
+ return -ENODEV;
mutex_init(&chip->lock);
--
2.43.0.rc1.1336.g36b5255a03ac