diff mbox series

[v1,4/4] iio: light: isl29018: Check if name is valid in isl29018_probe()

Message ID 20241030160756.2099326-5-andriy.shevchenko@linux.intel.com (mailing list archive)
State New
Headers show
Series iio: acpi: always initialise data in iio_get_acpi_device_name_and_data() | expand

Commit Message

Andy Shevchenko Oct. 30, 2024, 4:02 p.m. UTC
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 mbox series

Patch

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);