Message ID | 20241101081203.3360421-4-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | iio: initialise ddata for iio_get_acpi_device_name_and_data() | expand |
> When iio_get_acpi_device_name_and_data() fails, the ddata may be left > uninitialised. Initialise it to NULL and drop unneeded NULL check > in kxcjk1013_probe() I propose to reduce the scope for this local variable. How do you think about to use a summary phrase like “Replace a pointer check by a variable initialisation in kxcjk1013_probe()” instead? Regards, Markus
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 28ed0e09d099..753ec2f71a9a 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1462,7 +1462,7 @@ static int kxcjk1013_probe(struct i2c_client *client) struct kxcjk1013_data *data; struct iio_dev *indio_dev; struct kxcjk_1013_platform_data *pdata; - const void *ddata; + const void *ddata = NULL; const char *name; int ret; @@ -1507,8 +1507,7 @@ static int kxcjk1013_probe(struct i2c_client *client) data->info = (const struct kx_chipset_info *)(id->driver_data); } else { name = iio_get_acpi_device_name_and_data(&client->dev, &ddata); - if (name) - data->info = ddata; + data->info = ddata; if (data->info == &kxcj91008_kiox010a_info) indio_dev->label = "accel-display"; else if (data->info == &kxcj91008_kiox020a_info)
When iio_get_acpi_device_name_and_data() fails, the ddata may be left uninitialised. Initialise it to NULL and drop unneeded NULL check in kxcjk1013_probe() Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/iio/accel/kxcjk-1013.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)