io: adc: ad7606_core: fix signed/unsigned number comparison
Subsystems (4)
PATCH 1/1 io: adc: ad7606_core: fix signed/unsigned number comparison
reported by 'make W=2' in ad7606_oversampling_get_index()
--- drivers/staging/iio/adc/ad7606_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/ad7606_core.c +1 -1
@@ -158,7 +158,7 @@ static ssize_t ad7606_show_oversampling_ratio(struct device *dev,static int ad7606_oversampling_get_index (unsigned int val) {unsigned char supported[] = {0 ,2 ,4 ,8 ,16 ,32 ,64 }; -int i; +unsigned int i;for (i =0 ; i <ARRAY_SIZE (supported); i++)if (val == supported[i])
Signature · 1 line
2.9.3
Jonathan Cameron
maintainerQuoted 3 lines · Ico Doornekamp
reported by 'make W=2' in
ad7606_oversampling_get_index()Signed-off-by Ico Doornekamp <[email protected]>
hmm. It's pretty much a non problem in the first place as we know
it can't cause issues (can see it is 7). Also this really just
moves to typecasting it later when we return i.
So unless I'm missing something I'm not going to apply this one.
If Greg picks it up I don't mind though as doesn't do any harm really.
Jonathan
Quoted 18 lines
--- drivers/staging/iio/adc/ad7606_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7606_core.c +1
-1@@ -158,7 +158,7 @@ static ssize_t ad7606_show_oversampling_ratio(struct device *dev,static int ad7606_oversampling_get_index (unsigned int val) {unsigned char supported[] = {0 ,2 ,4 ,8 ,16 ,32 ,64 }; -int i; +unsigned int i;for (i =0 ; i <ARRAY_SIZE (supported); i++)if (val == supported[i])
Quoted 9 lines · * On 2016-10-01 18:09:44 +0200, Jonathan Cameron wrote:
Quoted 3 lines · Ico Doornekamp
reported by 'make W=2' in
ad7606_oversampling_get_index()Signed-off-by Ico Doornekamp <[email protected]>hmm. It's pretty much a non problem in the first place as we know
it can't cause issues (can see it is 7). Also this really just
moves to typecasting it later when we return i.So unless I'm missing something I'm not going to apply this one.
Fair enough. It's one of those little penguin task things again, you probably guessed already. 'Find a bug reported by sparse and fix it'. But your IIO tree is simply too high-quality, sparse has nothing to complain :)
Signature · 2 lines
:wq ^X^Cy^K^X^C^C^C^C
Quoted 10 lines · Ico Doornekamp
Quoted 8 lines · * On 2016-10-01 18:09:44 +0200, Jonathan Cameron wrote:
Quoted 3 lines · Ico Doornekamp
reported by 'make W=2' in
ad7606_oversampling_get_index()Signed-off-by Ico Doornekamp <[email protected]>hmm. It's pretty much a non problem in the first place as we know
it can't cause issues (can see it is 7). Also this really just
moves to typecasting it later when we return i.
Quoted 6 lines
Quoted 1 line
So unless I'm missing something I'm not going to apply this one.
Fair enough. It's one of those little penguin task things again, you probably guessed already. 'Find a bug reported by sparse and fix it'. But your IIO tree is simply too high-quality, sparse has nothing to complain :)
Hi Ico,
Flattering the maintainer, always good and so true, so true :)
Here's something found by sparse for little penguin. See the Outreachy tasks page. https://kernelnewbies.org/IIO_tasks
You'll see I leveraged your IIO_CHAN* patch for the first coding task. We have a second coding task for sparse endianness patches. There are some remaining. If you tell me you're grabbing one, I'll put it on our claimed page so an applicant doesn't start on it.
I know this one is unclaimed at the moment:
CHECK drivers/iio/magnetometer/ak8974.cdrivers/iio/magnetometer/ak8974.c:403:16: warning: cast to restricted __le16drivers/iio/magnetometer/ak8974.c:480:24: warning: cast to restricted __le16
alisons
Quoted 8 lines
Signature · 7 lines
-- :wq ^X^Cy^K^X^C^C^C^C -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · * On 2016-10-01 18:49:33 +0200, Alison Schofield wrote:
Flattering the maintainer, always good and so true, so true :)
Knowing when to flatter whom is often more imporant then cranking out sweet code :)
Quoted 8 lines
Here's something found by sparse for little penguin. See the Outreachy tasks page. https://kernelnewbies.org/IIO_tasks
You'll see I leveraged your IIO_CHAN* patch for the first coding task. We have a second coding task for sparse endianness patches. There are some remaining. If you tell me you're grabbing one, I'll put it on our claimed page so an applicant doesn't start on it.
Quoted 6 lines
I know this one is unclaimed at the moment:
CHECKdrivers/iio/magnetometer/ak8974.cdrivers/iio/magnetometer/ak8974.c:403:16: warning: cast to restricted__le16drivers/iio/magnetometer/ak8974.c:480:24: warning: cast to restricted__le16
Ah, great, I missed those. Patch following. Thanks,
Signature · 2 lines
:wq ^X^Cy^K^X^C^C^C^C