From: Mauro Carvalho Chehab Date: Sat, 27 Oct 2012 19:14:01 +0000 (-0300) Subject: [media] dvb-frontends: get rid of some "always false" warnings X-Git-Tag: v3.9-rc1~93^2~765 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=830e4b55b02b8a2638958e4249eba71797940ee5;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [media] dvb-frontends: get rid of some "always false" warnings On gcc, enums are generally unsigned, except if a negative value is declared. Due to that, warnings may happen there: drivers/media/dvb-frontends/cx22700.c:142:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/cx22700.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/cx24123.c:341:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/l64781.c:183:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/l64781.c:187:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/mt312.c:552:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/dvb-frontends/mt312.c:560:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] As other compilers might be using signed values, the better is to keep the checks there, casting the value to avoid the warning. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c index f2a90f9..3d399d9 100644 --- a/drivers/media/dvb-frontends/cx22700.c +++ b/drivers/media/dvb-frontends/cx22700.c @@ -139,7 +139,7 @@ static int cx22700_set_tps(struct cx22700_state *state, if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) return -EINVAL; - if (p->guard_interval < GUARD_INTERVAL_1_32 || + if ((int)p->guard_interval < GUARD_INTERVAL_1_32 || p->guard_interval > GUARD_INTERVAL_1_4) return -EINVAL; @@ -152,7 +152,7 @@ static int cx22700_set_tps(struct cx22700_state *state, p->modulation != QAM_64) return -EINVAL; - if (p->hierarchy < HIERARCHY_NONE || + if ((int)p->hierarchy < HIERARCHY_NONE || p->hierarchy > HIERARCHY_4) return -EINVAL; diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 7e28b4e..68c88ab 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c @@ -338,7 +338,7 @@ static int cx24123_set_fec(struct cx24123_state *state, fe_code_rate_t fec) { u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; - if ((fec < FEC_NONE) || (fec > FEC_AUTO)) + if (((int)fec < FEC_NONE) || (fec > FEC_AUTO)) fec = FEC_AUTO; /* Set the soft decision threshold */ diff --git a/drivers/media/dvb-frontends/l64781.c b/drivers/media/dvb-frontends/l64781.c index 36fcf55..ddf866c 100644 --- a/drivers/media/dvb-frontends/l64781.c +++ b/drivers/media/dvb-frontends/l64781.c @@ -180,11 +180,11 @@ static int apply_frontend_param(struct dvb_frontend *fe) p->transmission_mode != TRANSMISSION_MODE_8K) return -EINVAL; - if (p->guard_interval < GUARD_INTERVAL_1_32 || + if ((int)p->guard_interval < GUARD_INTERVAL_1_32 || p->guard_interval > GUARD_INTERVAL_1_4) return -EINVAL; - if (p->hierarchy < HIERARCHY_NONE || + if ((int)p->hierarchy < HIERARCHY_NONE || p->hierarchy > HIERARCHY_4) return -EINVAL; diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c index e20bf13..ec388c1d 100644 --- a/drivers/media/dvb-frontends/mt312.c +++ b/drivers/media/dvb-frontends/mt312.c @@ -549,7 +549,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe) || (p->frequency > fe->ops.info.frequency_max)) return -EINVAL; - if ((p->inversion < INVERSION_OFF) + if (((int)p->inversion < INVERSION_OFF) || (p->inversion > INVERSION_ON)) return -EINVAL; @@ -557,7 +557,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe) || (p->symbol_rate > fe->ops.info.symbol_rate_max)) return -EINVAL; - if ((p->fec_inner < FEC_NONE) + if (((int)p->fec_inner < FEC_NONE) || (p->fec_inner > FEC_AUTO)) return -EINVAL;