forked from luck/tmp_suning_uos_patched
iio: imu: inv_mpu6050: Prevent dereferencing NULL
When id is null, with ACPI enumeration, don't dereference it. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
f2229ab861
commit
4f33fbae55
@ -690,7 +690,11 @@ static int inv_mpu_probe(struct i2c_client *client,
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = id->name;
|
||||
/* id will be NULL when enumerated via ACPI */
|
||||
if (id)
|
||||
indio_dev->name = (char *)id->name;
|
||||
else
|
||||
indio_dev->name = (char *)dev_name(&client->dev);
|
||||
indio_dev->channels = inv_mpu_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user