From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: imu: inv_mpu6050: Prevent dereferencing NULL
Date: Sat, 10 Jan 2015 22:08:13 +0000 [thread overview]
Message-ID: <54B1A2CD.40208@kernel.org> (raw)
In-Reply-To: <1420845217-16920-1-git-send-email-srinivas.pandruvada@linux.intel.com>
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@linux.intel.com>
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);
>
>
prev parent reply other threads:[~2015-01-10 22:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 23:13 [PATCH] iio: imu: inv_mpu6050: Prevent dereferencing NULL Srinivas Pandruvada
2015-01-10 22:08 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54B1A2CD.40208@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).