Commit 4f33fbae authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jonathan Cameron

iio: imu: inv_mpu6050: Prevent dereferencing NULL

When id is null, with ACPI enumeration, don't dereference it.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f2229ab8
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment