iio: imu: mpu6050: fix possible NULL dereferences
[deliverable/linux.git] / drivers / iio / imu / inv_mpu6050 / inv_mpu_i2c.c
index f581256d9d4c2473eca8979b3c0075c308f844a8..d0c0e20c7122d006ebbb5fa5e94ef1c50b7eb6ea 100644 (file)
@@ -117,6 +117,7 @@ static int inv_mpu_probe(struct i2c_client *client,
        struct inv_mpu6050_state *st;
        int result;
        const char *name = id ? id->name : NULL;
+       const int chip_type = id ? id->driver_data : 0;
        struct regmap *regmap;
 
        if (!i2c_check_functionality(client->adapter,
@@ -131,7 +132,7 @@ static int inv_mpu_probe(struct i2c_client *client,
        }
 
        result = inv_mpu_core_probe(regmap, client->irq, name,
-                                   NULL, id->driver_data);
+                                   NULL, chip_type);
        if (result < 0)
                return result;
 
This page took 0.042574 seconds and 5 git commands to generate.