* [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD
@ 2019-03-23 2:46 Kangjie Lu
2019-04-04 19:47 ` Sean Young
0 siblings, 1 reply; 3+ messages in thread
From: Kangjie Lu @ 2019-03-23 2:46 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, Mauro Carvalho Chehab, linux-media, linux-kernel
Conservatively check return value of STV090x_WRITE_DEMOD in case
it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/media/dvb-frontends/stv090x.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index a0622bb71803..3e2af3969e16 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -1446,14 +1446,17 @@ static int stv090x_start_search(struct stv090x_state *state)
/* >= Cut 3 */
if (state->srate <= 5000000) {
/* enlarge the timing bandwidth for Low SR */
- STV090x_WRITE_DEMOD(state, RTCS2, 0x68);
+ if (STV090x_WRITE_DEMOD(state, RTCS2, 0x68) < 0)
+ goto err;
} else {
/* reduce timing bandwidth for high SR */
- STV090x_WRITE_DEMOD(state, RTCS2, 0x44);
+ if (STV090x_WRITE_DEMOD(state, RTCS2, 0x44) < 0)
+ goto err;
}
/* Set CFR min and max to manual mode */
- STV090x_WRITE_DEMOD(state, CARCFG, 0x46);
+ if (STV090x_WRITE_DEMOD(state, CARCFG, 0x46) < 0)
+ goto err;
if (state->algo == STV090x_WARM_SEARCH) {
/* WARM Start
@@ -2604,7 +2607,8 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
if (state->algo == STV090x_BLIND_SEARCH) {
tmg = STV090x_READ_DEMOD(state, TMGREG2);
- STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c);
+ if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c) < 0)
+ goto err;
while ((i <= 50) && (tmg != 0) && (tmg != 0xff)) {
tmg = STV090x_READ_DEMOD(state, TMGREG2);
msleep(5);
@@ -2910,7 +2914,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
pilots = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) & 0x01;
aclc = stv090x_optimize_carloop(state, modcod, pilots);
if (modcod <= STV090x_QPSK_910) {
- STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc);
+ if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc)
+ < 0)
+ goto err;
} else if (modcod <= STV090x_8PSK_910) {
if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, 0x2a) < 0)
goto err;
@@ -2972,7 +2978,8 @@ static int stv090x_optimize_track(struct stv090x_state *state)
reg = STV090x_READ_DEMOD(state, TMGOBS);
if (state->algo == STV090x_BLIND_SEARCH) {
- STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00);
+ if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00) < 0)
+ goto err;
reg = STV090x_READ_DEMOD(state, DMDCFGMD);
STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 0x00);
STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0x00);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD
2019-03-23 2:46 [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD Kangjie Lu
@ 2019-04-04 19:47 ` Sean Young
0 siblings, 0 replies; 3+ messages in thread
From: Sean Young @ 2019-04-04 19:47 UTC (permalink / raw)
To: Kangjie Lu; +Cc: pakki001, Mauro Carvalho Chehab, linux-media, linux-kernel
On Fri, Mar 22, 2019 at 09:46:13PM -0500, Kangjie Lu wrote:
> Conservatively check return value of STV090x_WRITE_DEMOD in case
> it fails.
This can introduce regressions. It is very possible that the return value
was not checked for a reason. So, this has to be tested on hardware.
Sean
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/media/dvb-frontends/stv090x.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
> index a0622bb71803..3e2af3969e16 100644
> --- a/drivers/media/dvb-frontends/stv090x.c
> +++ b/drivers/media/dvb-frontends/stv090x.c
> @@ -1446,14 +1446,17 @@ static int stv090x_start_search(struct stv090x_state *state)
> /* >= Cut 3 */
> if (state->srate <= 5000000) {
> /* enlarge the timing bandwidth for Low SR */
> - STV090x_WRITE_DEMOD(state, RTCS2, 0x68);
> + if (STV090x_WRITE_DEMOD(state, RTCS2, 0x68) < 0)
> + goto err;
> } else {
> /* reduce timing bandwidth for high SR */
> - STV090x_WRITE_DEMOD(state, RTCS2, 0x44);
> + if (STV090x_WRITE_DEMOD(state, RTCS2, 0x44) < 0)
> + goto err;
> }
>
> /* Set CFR min and max to manual mode */
> - STV090x_WRITE_DEMOD(state, CARCFG, 0x46);
> + if (STV090x_WRITE_DEMOD(state, CARCFG, 0x46) < 0)
> + goto err;
>
> if (state->algo == STV090x_WARM_SEARCH) {
> /* WARM Start
> @@ -2604,7 +2607,8 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
>
> if (state->algo == STV090x_BLIND_SEARCH) {
> tmg = STV090x_READ_DEMOD(state, TMGREG2);
> - STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c);
> + if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c) < 0)
> + goto err;
> while ((i <= 50) && (tmg != 0) && (tmg != 0xff)) {
> tmg = STV090x_READ_DEMOD(state, TMGREG2);
> msleep(5);
> @@ -2910,7 +2914,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
> pilots = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) & 0x01;
> aclc = stv090x_optimize_carloop(state, modcod, pilots);
> if (modcod <= STV090x_QPSK_910) {
> - STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc);
> + if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc)
> + < 0)
> + goto err;
> } else if (modcod <= STV090x_8PSK_910) {
> if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, 0x2a) < 0)
> goto err;
> @@ -2972,7 +2978,8 @@ static int stv090x_optimize_track(struct stv090x_state *state)
> reg = STV090x_READ_DEMOD(state, TMGOBS);
>
> if (state->algo == STV090x_BLIND_SEARCH) {
> - STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00);
> + if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00) < 0)
> + goto err;
> reg = STV090x_READ_DEMOD(state, DMDCFGMD);
> STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 0x00);
> STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0x00);
> --
> 2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD
@ 2019-03-09 6:30 Kangjie Lu
0 siblings, 0 replies; 3+ messages in thread
From: Kangjie Lu @ 2019-03-09 6:30 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, Mauro Carvalho Chehab, linux-media, linux-kernel
Conservatively check return value of STV090x_WRITE_DEMOD in case
it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/media/dvb-frontends/stv090x.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index a0622bb71803..3e2af3969e16 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -1446,14 +1446,17 @@ static int stv090x_start_search(struct stv090x_state *state)
/* >= Cut 3 */
if (state->srate <= 5000000) {
/* enlarge the timing bandwidth for Low SR */
- STV090x_WRITE_DEMOD(state, RTCS2, 0x68);
+ if (STV090x_WRITE_DEMOD(state, RTCS2, 0x68) < 0)
+ goto err;
} else {
/* reduce timing bandwidth for high SR */
- STV090x_WRITE_DEMOD(state, RTCS2, 0x44);
+ if (STV090x_WRITE_DEMOD(state, RTCS2, 0x44) < 0)
+ goto err;
}
/* Set CFR min and max to manual mode */
- STV090x_WRITE_DEMOD(state, CARCFG, 0x46);
+ if (STV090x_WRITE_DEMOD(state, CARCFG, 0x46) < 0)
+ goto err;
if (state->algo == STV090x_WARM_SEARCH) {
/* WARM Start
@@ -2604,7 +2607,8 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
if (state->algo == STV090x_BLIND_SEARCH) {
tmg = STV090x_READ_DEMOD(state, TMGREG2);
- STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c);
+ if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c) < 0)
+ goto err;
while ((i <= 50) && (tmg != 0) && (tmg != 0xff)) {
tmg = STV090x_READ_DEMOD(state, TMGREG2);
msleep(5);
@@ -2910,7 +2914,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
pilots = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) & 0x01;
aclc = stv090x_optimize_carloop(state, modcod, pilots);
if (modcod <= STV090x_QPSK_910) {
- STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc);
+ if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc)
+ < 0)
+ goto err;
} else if (modcod <= STV090x_8PSK_910) {
if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, 0x2a) < 0)
goto err;
@@ -2972,7 +2978,8 @@ static int stv090x_optimize_track(struct stv090x_state *state)
reg = STV090x_READ_DEMOD(state, TMGOBS);
if (state->algo == STV090x_BLIND_SEARCH) {
- STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00);
+ if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00) < 0)
+ goto err;
reg = STV090x_READ_DEMOD(state, DMDCFGMD);
STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 0x00);
STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0x00);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-04 19:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 2:46 [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD Kangjie Lu
2019-04-04 19:47 ` Sean Young
-- strict thread matches above, loose matches on Subject: below --
2019-03-09 6:30 Kangjie Lu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.