staging: iio: adc: Remove unnecessary test from if conditions
Subsystems (4)
PATCH 1/1 staging: iio: adc: Remove unnecessary test from if conditions
Remove unnecessary test condition on ret variable which has been previously tested and returns its value if the value is non zero.
This fixes the following smatch warnings:drivers/staging/iio/adc/ad7816.c:299 ad7816_set_oti() warn: we tested 'ret' before and it was 'false' drivers/staging/iio/adc/ad7816.c:306 ad7816_set_oti() warn: we tested 'ret' before and it was 'false'
--- drivers/staging/iio/adc/ad7816.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7816.c +2 -2
@@ -296,14 +296,14 @@ static inline ssize_t ad7816_set_oti(struct device *dev,dev_err (dev,"Invalid oti channel id %d.\n" , chip->channel_id);return -EINVAL ; }else if (chip->channel_id ==0 ) { -if (ret || value <AD7816_BOUND_VALUE_MIN || +if (value <AD7816_BOUND_VALUE_MIN || value >AD7816_BOUND_VALUE_MAX )return -EINVAL ; data = (u8)(value -AD7816_BOUND_VALUE_MIN +AD7816_BOUND_VALUE_BASE ); }else { -if (ret || value <AD7816_BOUND_VALUE_BASE || value >255 ) +if (value <AD7816_BOUND_VALUE_BASE || value >255 )return -EINVAL ; data = (u8 )value;
Signature · 1 line
1.9.1
Quoted 10 lines · Amitoj Kaur Chawla
Remove unnecessary test condition on ret variable which has been previously tested and returns its value if the value is non zero.
This fixes the following smatch warnings:
drivers/staging/iio/adc/ad7816.c:299ad7816_set_oti()warn: we tested 'ret' before and it was 'false'drivers/staging/iio/adc/ad7816.c:306ad7816_set_oti()warn: we tested 'ret' before and it was 'false'Signed-off-by Amitoj Kaur Chawla <[email protected]>
Nice catch.
Quoted 34 lines
--- drivers/staging/iio/adc/ad7816.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/iio/adc/ad7816.c +2
-3@@ -296,14 +296,14 @@ static inline ssize_t ad7816_set_oti(struct device *dev,dev_err (dev,"Invalid oti channel id %d.\n" , chip->channel_id);return -EINVAL ; }else if (chip->channel_id ==0 ) { -if (ret || value <AD7816_BOUND_VALUE_MIN || +if (value <AD7816_BOUND_VALUE_MIN || value >AD7816_BOUND_VALUE_MAX )return -EINVAL ; data = (u8)(value -AD7816_BOUND_VALUE_MIN +AD7816_BOUND_VALUE_BASE ); }else { -if (ret || value <AD7816_BOUND_VALUE_BASE || value >255 ) +if (value <AD7816_BOUND_VALUE_BASE || value >255 )return -EINVAL ; data = (u8 )value; --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160216181431.GA1934%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.