diff options
author | Matt Ranostay <matt.ranostay@intel.com> | 2016-03-03 06:18:12 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-03-05 20:51:10 +0300 |
commit | c816d9e7a57bd436b2cff8f48b0e8cff128f05db (patch) | |
tree | 61d6daee8ca6adeb27da41a03883f198bf8c249f /drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | |
parent | 96c0cb2bbfe0a58bd0c37cf34d50a20f9cd75aa8 (diff) | |
download | linux-c816d9e7a57bd436b2cff8f48b0e8cff128f05db.tar.xz |
iio: imu: mpu6050: fix possible NULL dereferences
Fix possible null dereferencing of i2c and spi driver data.
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c')
-rw-r--r-- | drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c index dea6c4361de0..7bcb8d839f05 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c @@ -46,6 +46,7 @@ static int inv_mpu_probe(struct spi_device *spi) struct regmap *regmap; const struct spi_device_id *id = spi_get_device_id(spi); const char *name = id ? id->name : NULL; + const int chip_type = id ? id->driver_data : 0; regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config); if (IS_ERR(regmap)) { @@ -55,7 +56,7 @@ static int inv_mpu_probe(struct spi_device *spi) } return inv_mpu_core_probe(regmap, spi->irq, name, - inv_mpu_i2c_disable, id->driver_data); + inv_mpu_i2c_disable, chip_type); } static int inv_mpu_remove(struct spi_device *spi) |