* [PATCH] [media] mb86a20s: remove redundant check if val is less than zero
@ 2016-07-12 9:30 Colin King
2016-07-15 15:20 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2016-07-12 9:30 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media; +Cc: linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero
2016-07-12 9:30 [PATCH] [media] mb86a20s: remove redundant check if val is less than zero Colin King
@ 2016-07-15 15:20 ` Mauro Carvalho Chehab
2016-07-15 15:45 ` Colin Ian King
0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2016-07-15 15:20 UTC (permalink / raw)
To: Colin King; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] mb86a20s: remove redundant check if val is less than zero
2016-07-15 15:20 ` Mauro Carvalho Chehab
@ 2016-07-15 15:45 ` Colin Ian King
0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2016-07-15 15:45 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-15 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-12 9:30 [PATCH] [media] mb86a20s: remove redundant check if val is less than zero Colin King
2016-07-15 15:20 ` Mauro Carvalho Chehab
2016-07-15 15:45 ` Colin Ian King
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).