diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2015-01-09 15:13:37 -0800 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-01-10 22:07:50 +0000 |
commit | 4f33fbae555000bf73aaacbc4f5b24668afc8c7a (patch) | |
tree | d30a77c6c0b9ccb0644d01f0900c9f1e5d971173 /drivers/iio/imu | |
parent | f2229ab8611e6e79992b6357db3fb4faf70e74a9 (diff) | |
download | linux-4f33fbae555000bf73aaacbc4f5b24668afc8c7a.tar.bz2 |
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>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r-- | drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index b75519deac1a..eedd3e07d27c 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -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); |