Re: [PATCH] iio: imu: inv_mpu6050: Prevent dereferencing NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/01/15 23:13, Srinivas Pandruvada wrote:
> When id is null, with ACPI enumeration, don't dereference it.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index f73e60b..d8d5bed 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -780,7 +780,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);
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux