diff options
author | Colin Ian King <colin.king@canonical.com> | 2016-07-15 11:59:15 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-15 12:32:58 -0400 |
commit | eca2d34b9d2ce70165a50510659838e28ca22742 (patch) | |
tree | cd82afca63419c2b941af41f288d87a42deb9233 | |
parent | 785ef73dba6e9fefd2e5dd24546e0efa8698e5cd (diff) |
[media] mb86a20s: apply mask to val after checking for read failure
Appling the mask 0x0f to the immediate return of the call to
mb86a20s_readreg will always result in a positive value, meaning that the
check of ret < 0 will never work. Instead, check for a -ve return value
first, and then mask val with 0x0f.
Kudos to Mauro Carvalho Chehab for spotting the mistake in my original fix.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/dvb-frontends/mb86a20s.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index fb88dddaf3a3..41325328a22e 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c | |||
@@ -301,10 +301,11 @@ static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status) | |||
301 | 301 | ||
302 | *status = 0; | 302 | *status = 0; |
303 | 303 | ||
304 | val = mb86a20s_readreg(state, 0x0a) & 0xf; | 304 | val = mb86a20s_readreg(state, 0x0a); |
305 | if (val < 0) | 305 | if (val < 0) |
306 | return val; | 306 | return val; |
307 | 307 | ||
308 | val &= 0xf; | ||
308 | if (val >= 2) | 309 | if (val >= 2) |
309 | *status |= FE_HAS_SIGNAL; | 310 | *status |= FE_HAS_SIGNAL; |
310 | 311 | ||