summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-11-01 17:05:59 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-11 13:04:57 -0500
commit07ade2d0f680864ba0c93553d008900dd3e1a421 (patch)
tree150c5feed8cf5b14cead924e776cf603f48258bb /drivers/media/dvb-frontends
parent04f849c00cf6228092d37876896fbd541a0f3393 (diff)
media: cxd2841er: ensure that status will always be available
The loop with read status use a dynamic timeout value, calculated from symbol rate. It should run the loop at least one time for the status to be handled after the loop. While this should, in practice, happen every time, it doesn't hurt to change the logic to make it explicit. This solves a smatch warning: drivers/media/dvb-frontends/cxd2841er.c:3350 cxd2841er_set_frontend_s() error: uninitialized symbol 'status'. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/cxd2841er.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
index 2cb97a3130be..17e4db7900e5 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -3339,13 +3339,17 @@ static int cxd2841er_set_frontend_s(struct dvb_frontend *fe)
cxd2841er_tune_done(priv);
timeout = ((3000000 + (symbol_rate - 1)) / symbol_rate) + 150;
- for (i = 0; i < timeout / CXD2841ER_DVBS_POLLING_INVL; i++) {
+
+ i = 0;
+ do {
usleep_range(CXD2841ER_DVBS_POLLING_INVL*1000,
(CXD2841ER_DVBS_POLLING_INVL + 2) * 1000);
cxd2841er_read_status_s(fe, &status);
if (status & FE_HAS_LOCK)
break;
- }
+ i++;
+ } while (i < timeout / CXD2841ER_DVBS_POLLING_INVL);
+
if (status & FE_HAS_LOCK) {
if (cxd2841er_get_carrier_offset_s_s2(
priv, &carr_offset)) {