From: Colin Ian King Date: Fri, 15 Jul 2016 15:59:15 +0000 (-0300) Subject: [media] mb86a20s: apply mask to val after checking for read failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eca2d34b9d2ce70165a50510659838e28ca22742;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [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 Signed-off-by: Mauro Carvalho Chehab --- 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) *status = 0; - val = mb86a20s_readreg(state, 0x0a) & 0xf; + val = mb86a20s_readreg(state, 0x0a); if (val < 0) return val; + val &= 0xf; if (val >= 2) *status |= FE_HAS_SIGNAL;