aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-04-25 10:15:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-25 14:13:49 -0400
commit746f7ae0e9ca500f8be888675d88befed5740413 (patch)
tree0851360d535b8d169d2c7b1cf864f63c7ab386ef /drivers/media
parentc82056d0b4ac7b805ac4e7d3870c42bb19e3b3d5 (diff)
[media] dib8000: Fix sub-channel range
isdbt_sb_subchannel is unsigned with 8 bits. So, it will never be -1. Instead, any value bigger than 13 is invalid. As is, the current code generates the following warnings: drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_set_isdbt_common_channel': drivers/media/dvb-frontends/dib8000.c:2358:3: warning: comparison is always true due to limited range of data type [-Wtype-limits] drivers/media/dvb-frontends/dib8000.c: In function 'dib8000_tune': drivers/media/dvb-frontends/dib8000.c:3107:8: warning: comparison is always false due to limited range of data type [-Wtype-limits] drivers/media/dvb-frontends/dib8000.c:3153:9: warning: comparison is always false due to limited range of data type [-Wtype-limits] drivers/media/dvb-frontends/dib8000.c:3160:5: warning: comparison is always false It should also be noticed that ARIB STD-B31, item "3.15.6.8 Number of segments" at TMCC table defines the value 15 for unused segment, and 14 as reserved. So, better to change the check to consider any value bigger than 13 to mean that sub-channels should be disabled, fixing the warning and doing the right thing even if an invalid value is filled by userspace. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb-frontends/dib8000.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c
index 77dac46bfcbf..57863d3fd1cf 100644
--- a/drivers/media/dvb-frontends/dib8000.c
+++ b/drivers/media/dvb-frontends/dib8000.c
@@ -2355,7 +2355,7 @@ static void dib8000_set_isdbt_common_channel(struct dib8000_state *state, u8 seq
2355 /* TSB or ISDBT ? apply it now */ 2355 /* TSB or ISDBT ? apply it now */
2356 if (c->isdbt_sb_mode) { 2356 if (c->isdbt_sb_mode) {
2357 dib8000_set_sb_channel(state); 2357 dib8000_set_sb_channel(state);
2358 if (c->isdbt_sb_subchannel != -1) 2358 if (c->isdbt_sb_subchannel < 14)
2359 init_prbs = dib8000_get_init_prbs(state, c->isdbt_sb_subchannel); 2359 init_prbs = dib8000_get_init_prbs(state, c->isdbt_sb_subchannel);
2360 else 2360 else
2361 init_prbs = 0; 2361 init_prbs = 0;
@@ -3102,7 +3102,9 @@ static int dib8000_tune(struct dvb_frontend *fe)
3102 dib8000_set_isdbt_loop_params(state, LOOP_TUNE_2); 3102 dib8000_set_isdbt_loop_params(state, LOOP_TUNE_2);
3103 3103
3104 /* mpeg will never lock on this condition because init_prbs is not set : search for it !*/ 3104 /* mpeg will never lock on this condition because init_prbs is not set : search for it !*/
3105 if (c->isdbt_sb_mode && c->isdbt_sb_subchannel == -1 && !state->differential_constellation) { 3105 if (c->isdbt_sb_mode
3106 && c->isdbt_sb_subchannel < 14
3107 && !state->differential_constellation) {
3106 state->subchannel = 0; 3108 state->subchannel = 0;
3107 *tune_state = CT_DEMOD_STEP_11; 3109 *tune_state = CT_DEMOD_STEP_11;
3108 } else { 3110 } else {
@@ -3146,14 +3148,18 @@ static int dib8000_tune(struct dvb_frontend *fe)
3146 locks = dib8000_read_lock(fe); 3148 locks = dib8000_read_lock(fe);
3147 if (locks&(1<<(7-state->longest_intlv_layer))) { /* mpeg lock : check the longest one */ 3149 if (locks&(1<<(7-state->longest_intlv_layer))) { /* mpeg lock : check the longest one */
3148 dprintk("Mpeg locks [ L0 : %d | L1 : %d | L2 : %d ]", (locks>>7)&0x1, (locks>>6)&0x1, (locks>>5)&0x1); 3150 dprintk("Mpeg locks [ L0 : %d | L1 : %d | L2 : %d ]", (locks>>7)&0x1, (locks>>6)&0x1, (locks>>5)&0x1);
3149 if (c->isdbt_sb_mode && c->isdbt_sb_subchannel == -1 && !state->differential_constellation) 3151 if (c->isdbt_sb_mode
3152 && c->isdbt_sb_subchannel < 14
3153 && !state->differential_constellation)
3150 /* signal to the upper layer, that there was a channel found and the parameters can be read */ 3154 /* signal to the upper layer, that there was a channel found and the parameters can be read */
3151 state->status = FE_STATUS_DEMOD_SUCCESS; 3155 state->status = FE_STATUS_DEMOD_SUCCESS;
3152 else 3156 else
3153 state->status = FE_STATUS_DATA_LOCKED; 3157 state->status = FE_STATUS_DATA_LOCKED;
3154 *tune_state = CT_DEMOD_STOP; 3158 *tune_state = CT_DEMOD_STOP;
3155 } else if (now > *timeout) { 3159 } else if (now > *timeout) {
3156 if (c->isdbt_sb_mode && c->isdbt_sb_subchannel == -1 && !state->differential_constellation) { /* continue to try init prbs autosearch */ 3160 if (c->isdbt_sb_mode
3161 && c->isdbt_sb_subchannel < 14
3162 && !state->differential_constellation) { /* continue to try init prbs autosearch */
3157 state->subchannel += 3; 3163 state->subchannel += 3;
3158 *tune_state = CT_DEMOD_STEP_11; 3164 *tune_state = CT_DEMOD_STEP_11;
3159 } else { /* we are done mpeg of the longest interleaver xas not locking but let's try if an other layer has locked in the same time */ 3165 } else { /* we are done mpeg of the longest interleaver xas not locking but let's try if an other layer has locked in the same time */