Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1441180 > unrolled thread

[PATCH] [media] mb86a20s: remove redundant check if val is less than zero

Started byColin King <colin.king@canonical.com>
First post2016-07-12 11:40 +0200
Last post2016-07-15 17:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [media] mb86a20s: remove redundant check if val is less than zero Colin King <colin.king@canonical.com> - 2016-07-12 11:40 +0200
    Re: [PATCH] [media] mb86a20s: remove redundant check if val is less  than zero Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-07-15 17:30 +0200
      Re: [PATCH] [media] mb86a20s: remove redundant check if val is less  than zero Colin Ian King <colin.king@canonical.com> - 2016-07-15 17:50 +0200

#1441180 — [PATCH] [media] mb86a20s: remove redundant check if val is less than zero

FromColin King <colin.king@canonical.com>
Date2016-07-12 11:40 +0200
Subject[PATCH] [media] mb86a20s: remove redundant check if val is less than zero
Message-ID<rU2kx-32M-7@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

The result of mb86a20s_readreg(state, 0x0a) & 0xf is always in the range
0x00 to 0x0f and can never be negative, so remove the redundant check
of the result being less than zero.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/dvb-frontends/mb86a20s.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index fb88ddd..0205846 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -302,8 +302,6 @@ static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status)
 	*status = 0;
 
 	val = mb86a20s_readreg(state, 0x0a) & 0xf;
-	if (val < 0)
-		return val;
 
 	if (val >= 2)
 		*status |= FE_HAS_SIGNAL;
-- 
2.8.1

[toc] | [next] | [standalone]


#1444378 — Re: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero

FromMauro Carvalho Chehab <mchehab@s-opensource.com>
Date2016-07-15 17:30 +0200
SubjectRe: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero
Message-ID<rVddU-7n-27@gated-at.bofh.it>
In reply to#1441180
Em Tue, 12 Jul 2016 10:30:51 +0100
Colin King <colin.king@canonical.com> escreveu:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The result of mb86a20s_readreg(state, 0x0a) & 0xf is always in the range
> 0x00 to 0x0f and can never be negative, so remove the redundant check
> of the result being less than zero.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/media/dvb-frontends/mb86a20s.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
> index fb88ddd..0205846 100644
> --- a/drivers/media/dvb-frontends/mb86a20s.c
> +++ b/drivers/media/dvb-frontends/mb86a20s.c
> @@ -302,8 +302,6 @@ static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status)
>  	*status = 0;
>  
>  	val = mb86a20s_readreg(state, 0x0a) & 0xf;
> -	if (val < 0)
> -		return val;

Actually, mb86a20s_readreg() can return a negative value.

Please change the above logic to first check for the value returned
from mb86a20s_readreg() and then apply the bitmask.

Thanks,
Mauro

>  
>  	if (val >= 2)
>  		*status |= FE_HAS_SIGNAL;



Thanks,
Mauro

[toc] | [prev] | [next] | [standalone]


#1444397 — Re: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero

FromColin Ian King <colin.king@canonical.com>
Date2016-07-15 17:50 +0200
SubjectRe: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero
Message-ID<rVdxg-dW-23@gated-at.bofh.it>
In reply to#1444378
On 15/07/16 16:20, Mauro Carvalho Chehab wrote:
> Em Tue, 12 Jul 2016 10:30:51 +0100
> Colin King <colin.king@canonical.com> escreveu:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The result of mb86a20s_readreg(state, 0x0a) & 0xf is always in the range
>> 0x00 to 0x0f and can never be negative, so remove the redundant check
>> of the result being less than zero.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/media/dvb-frontends/mb86a20s.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
>> index fb88ddd..0205846 100644
>> --- a/drivers/media/dvb-frontends/mb86a20s.c
>> +++ b/drivers/media/dvb-frontends/mb86a20s.c
>> @@ -302,8 +302,6 @@ static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status)
>>  	*status = 0;
>>  
>>  	val = mb86a20s_readreg(state, 0x0a) & 0xf;
>> -	if (val < 0)
>> -		return val;
> 
> Actually, mb86a20s_readreg() can return a negative value.

Oops, yep, clearly my code is stupid. I'll send a fix soon.

> 
> Please change the above logic to first check for the value returned
> from mb86a20s_readreg() and then apply the bitmask.
> 
> Thanks,
> Mauro
> 
>>  
>>  	if (val >= 2)
>>  		*status |= FE_HAS_SIGNAL;
> 
> 
> 
> Thanks,
> Mauro
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web