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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux