Commit 07ade2d0 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 04f849c0
...@@ -3339,13 +3339,17 @@ static int cxd2841er_set_frontend_s(struct dvb_frontend *fe) ...@@ -3339,13 +3339,17 @@ static int cxd2841er_set_frontend_s(struct dvb_frontend *fe)
cxd2841er_tune_done(priv); cxd2841er_tune_done(priv);
timeout = ((3000000 + (symbol_rate - 1)) / symbol_rate) + 150; 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, usleep_range(CXD2841ER_DVBS_POLLING_INVL*1000,
(CXD2841ER_DVBS_POLLING_INVL + 2) * 1000); (CXD2841ER_DVBS_POLLING_INVL + 2) * 1000);
cxd2841er_read_status_s(fe, &status); cxd2841er_read_status_s(fe, &status);
if (status & FE_HAS_LOCK) if (status & FE_HAS_LOCK)
break; break;
} i++;
} while (i < timeout / CXD2841ER_DVBS_POLLING_INVL);
if (status & FE_HAS_LOCK) { if (status & FE_HAS_LOCK) {
if (cxd2841er_get_carrier_offset_s_s2( if (cxd2841er_get_carrier_offset_s_s2(
priv, &carr_offset)) { priv, &carr_offset)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment