Commit f14a2972 authored by Roel Kluin's avatar Roel Kluin Committed by Mauro Carvalho Chehab

V4L/DVB (13241): Cleanup redundant tests on unsigned

The variables are unsigned so the test `>= 0' is always true,
the `< 0' test always fails. In these cases the other part of
the test catches wrapped values.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 311c70e1
...@@ -463,7 +463,7 @@ static int tda9887_set_insmod(struct dvb_frontend *fe) ...@@ -463,7 +463,7 @@ static int tda9887_set_insmod(struct dvb_frontend *fe)
buf[1] &= ~cQSS; buf[1] &= ~cQSS;
} }
if (adjust >= 0x00 && adjust < 0x20) { if (adjust < 0x20) {
buf[2] &= ~cTopMask; buf[2] &= ~cTopMask;
buf[2] |= adjust; buf[2] |= adjust;
} }
......
...@@ -1373,7 +1373,7 @@ static int GetGpioPinParams(u32 PinNum, u32 *pTranslatedPinNum, ...@@ -1373,7 +1373,7 @@ static int GetGpioPinParams(u32 PinNum, u32 *pTranslatedPinNum,
*pGroupCfg = 1; *pGroupCfg = 1;
if (PinNum >= 0 && PinNum <= 1) { if (PinNum <= 1) {
*pTranslatedPinNum = 0; *pTranslatedPinNum = 0;
*pGroupNum = 9; *pGroupNum = 9;
*pGroupCfg = 2; *pGroupCfg = 2;
......
...@@ -299,7 +299,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd, ...@@ -299,7 +299,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd,
v4l2_dbg(1, debug, sd, "set input %x\n", input); v4l2_dbg(1, debug, sd, "set input %x\n", input);
if (input < 0 || input > 7) if (input > 7)
return -EINVAL; return -EINVAL;
if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL)
......
...@@ -251,7 +251,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) ...@@ -251,7 +251,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); DEB_EE(("VIDIOC_S_INPUT %d.\n", input));
if (input < 0 || input >= HEXIUM_INPUTS) if (input >= HEXIUM_INPUTS)
return -EINVAL; return -EINVAL;
hexium->cur_input = input; hexium->cur_input = input;
......
...@@ -350,7 +350,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) ...@@ -350,7 +350,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct hexium *hexium = (struct hexium *) dev->ext_priv; struct hexium *hexium = (struct hexium *) dev->ext_priv;
if (input < 0 || input >= HEXIUM_INPUTS) if (input >= HEXIUM_INPUTS)
return -EINVAL; return -EINVAL;
hexium->cur_input = input; hexium->cur_input = input;
......
...@@ -478,7 +478,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) ...@@ -478,7 +478,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); DEB_EE(("VIDIOC_S_INPUT %d.\n", input));
if (input < 0 || input >= MXB_INPUTS) if (input >= MXB_INPUTS)
return -EINVAL; return -EINVAL;
mxb->cur_input = input; mxb->cur_input = input;
......
...@@ -1958,7 +1958,7 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) ...@@ -1958,7 +1958,7 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
if (pdword[1] >= MAX_CHANNELS) if (pdword[1] >= MAX_CHANNELS)
break; break;
cc = G_chnmap[pdword[1]]; cc = G_chnmap[pdword[1]];
if (!(cc >= 0 && cc < MAX_CHANNELS)) if (cc >= MAX_CHANNELS)
break; break;
switch (pdword[2]) { switch (pdword[2]) {
case S2255_RESPONSE_SETMODE: case S2255_RESPONSE_SETMODE:
......
...@@ -304,7 +304,7 @@ static int saa7110_s_routing(struct v4l2_subdev *sd, ...@@ -304,7 +304,7 @@ static int saa7110_s_routing(struct v4l2_subdev *sd,
{ {
struct saa7110 *decoder = to_saa7110(sd); struct saa7110 *decoder = to_saa7110(sd);
if (input < 0 || input >= SAA7110_MAX_INPUT) { if (input >= SAA7110_MAX_INPUT) {
v4l2_dbg(1, debug, sd, "input=%d not available\n", input); v4l2_dbg(1, debug, sd, "input=%d not available\n", input);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1115,7 +1115,7 @@ static int saa717x_s_video_routing(struct v4l2_subdev *sd, ...@@ -1115,7 +1115,7 @@ static int saa717x_s_video_routing(struct v4l2_subdev *sd,
v4l2_dbg(1, debug, sd, "decoder set input (%d)\n", input); v4l2_dbg(1, debug, sd, "decoder set input (%d)\n", input);
/* inputs from 0-9 are available*/ /* inputs from 0-9 are available*/
/* saa717x have mode0-mode9 but mode5 is reserved. */ /* saa717x have mode0-mode9 but mode5 is reserved. */
if (input < 0 || input > 9 || input == 5) if (input > 9 || input == 5)
return -EINVAL; return -EINVAL;
if (decoder->input != input) { if (decoder->input != input) {
......
...@@ -328,7 +328,7 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -328,7 +328,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
t->type = type; t->type = type;
/* prevent invalid config values */ /* prevent invalid config values */
t->config = ((new_config >= 0) && (new_config < 256)) ? new_config : 0; t->config = new_config < 256 ? new_config : 0;
if (tuner_callback != NULL) { if (tuner_callback != NULL) {
tuner_dbg("defining GPIO callback\n"); tuner_dbg("defining GPIO callback\n");
t->fe.callback = tuner_callback; t->fe.callback = tuner_callback;
......
...@@ -601,7 +601,7 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input) ...@@ -601,7 +601,7 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input)
{ {
struct usb_usbvision *usbvision = video_drvdata(file); struct usb_usbvision *usbvision = video_drvdata(file);
if ((input >= usbvision->video_inputs) || (input < 0) ) if (input >= usbvision->video_inputs)
return -EINVAL; return -EINVAL;
mutex_lock(&usbvision->lock); mutex_lock(&usbvision->lock);
......
...@@ -391,7 +391,7 @@ static int vpx3220_s_routing(struct v4l2_subdev *sd, ...@@ -391,7 +391,7 @@ static int vpx3220_s_routing(struct v4l2_subdev *sd,
{0x0e, 1} {0x0e, 1}
}; };
if (input < 0 || input > 2) if (input > 2)
return -EINVAL; return -EINVAL;
v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[input]); v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[input]);
......
...@@ -2764,7 +2764,7 @@ static int zoran_enum_input(struct file *file, void *__fh, ...@@ -2764,7 +2764,7 @@ static int zoran_enum_input(struct file *file, void *__fh,
struct zoran_fh *fh = __fh; struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
if (inp->index < 0 || inp->index >= zr->card.inputs) if (inp->index >= zr->card.inputs)
return -EINVAL; return -EINVAL;
else { else {
int id = inp->index; int id = inp->index;
......
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