From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>,
Ioana Ciornei <ciorneiioana@gmail.com>,
linux-iio@vger.kernel.org
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [PATCH 1/2] iio: gyro: check sscanf return value
Date: Tue, 03 Nov 2015 10:22:26 +0100 [thread overview]
Message-ID: <56387CD2.3010906@metafoo.de> (raw)
In-Reply-To: <56365728.9020304@kernel.org>
On 11/01/2015 07:17 PM, Jonathan Cameron wrote:
> On 01/11/15 12:58, Ioana Ciornei wrote:
>> This patch fixes the checkpatch warnings:
>> WARNING: unchecked sscanf return value
>>
>> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> Hi Ioana,
>
> Couple of minor process points (the patches are fine!)
>
> You should have cc'd the driver author and generally also
> the various listed reviewers in MAINTAINERS. In this case
> of of them is the driver author so possibly just pinging him
> is the way to go. In the case of Analog devices parts,
> Lars-Peter is also the maintainer so it's all about as
> easy as it gets in this case.
>
> Lars, looks fine to me. Your driver so please sanity check.
> Clearly it's not a bug as the inputs are entirely controlled
> by the driver code, but I think having a sanity check on
> the return value is a good thing (from the point of view of
> best practice).
As you say strictly speaking it is not necessary, but if it makes checkpatch
happy why not.
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
>
> There is a second patch for some the IIO drivers that are your
> problem as well - I'll let you pull that off the list as I'm
> feeling lazy ;)
>
> I did have to check that sscanf never returns any more helpful
> error codes, but unlike the glibc one it seems not. What fun.
>
> Jonathan
>> ---
>>
>> based on linux-iio/testing branch
>>
>> drivers/iio/gyro/adis16136.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
>> index 26de876..bb09bff 100644
>> --- a/drivers/iio/gyro/adis16136.c
>> +++ b/drivers/iio/gyro/adis16136.c
>> @@ -435,7 +435,9 @@ static int adis16136_initial_setup(struct iio_dev *indio_dev)
>> if (ret)
>> return ret;
>>
>> - sscanf(indio_dev->name, "adis%u\n", &device_id);
>> + ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
>> + if (ret != 1)
>> + return -EINVAL;
>>
>> if (prod_id != device_id)
>> dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.",
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-11-03 9:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 12:58 [PATCH 1/2] iio: gyro: check sscanf return value Ioana Ciornei
2015-11-01 12:58 ` [PATCH 2/2] iio: imu: " Ioana Ciornei
2015-11-08 15:45 ` Jonathan Cameron
2015-11-01 18:17 ` [PATCH 1/2] iio: gyro: " Jonathan Cameron
2015-11-01 20:08 ` Ioana Ciornei
2015-11-03 9:22 ` Lars-Peter Clausen [this message]
2015-11-08 15:44 ` Jonathan Cameron
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=56387CD2.3010906@metafoo.de \
--to=lars@metafoo.de \
--cc=ciorneiioana@gmail.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.