mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
V4L/DVB: cleanup redundant tests on unsigned
Remove redundant tests on unsigned. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
ca19d84295
commit
223ffe5f82
12 changed files with 18 additions and 18 deletions
|
@ -458,7 +458,7 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
|
|||
dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index);
|
||||
|
||||
if (av7110->analog_tuner_flags) {
|
||||
if (i->index < 0 || i->index >= 4)
|
||||
if (i->index >= 4)
|
||||
return -EINVAL;
|
||||
} else {
|
||||
if (i->index != 0)
|
||||
|
|
|
@ -1413,7 +1413,7 @@ static struct v4l2_input knc1_inputs[KNC1_INPUTS] = {
|
|||
static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
|
||||
{
|
||||
dprintk(1, "VIDIOC_ENUMINPUT %d.\n", i->index);
|
||||
if (i->index < 0 || i->index >= KNC1_INPUTS)
|
||||
if (i->index >= KNC1_INPUTS)
|
||||
return -EINVAL;
|
||||
memcpy(i, &knc1_inputs[i->index], sizeof(struct v4l2_input));
|
||||
return 0;
|
||||
|
|
|
@ -1064,7 +1064,7 @@ static int ioctl_querymenu(void *arg,struct camera_data *cam)
|
|||
|
||||
switch(m->id) {
|
||||
case CPIA2_CID_FLICKER_MODE:
|
||||
if(m->index < 0 || m->index >= NUM_FLICKER_CONTROLS)
|
||||
if (m->index >= NUM_FLICKER_CONTROLS)
|
||||
return -EINVAL;
|
||||
|
||||
strcpy(m->name, flicker_controls[m->index].name);
|
||||
|
@ -1082,14 +1082,14 @@ static int ioctl_querymenu(void *arg,struct camera_data *cam)
|
|||
maximum = i;
|
||||
}
|
||||
}
|
||||
if(m->index < 0 || m->index > maximum)
|
||||
if (m->index > maximum)
|
||||
return -EINVAL;
|
||||
|
||||
strcpy(m->name, framerate_controls[m->index].name);
|
||||
break;
|
||||
}
|
||||
case CPIA2_CID_LIGHTS:
|
||||
if(m->index < 0 || m->index >= NUM_LIGHTS_CONTROLS)
|
||||
if (m->index >= NUM_LIGHTS_CONTROLS)
|
||||
return -EINVAL;
|
||||
|
||||
strcpy(m->name, lights_controls[m->index].name);
|
||||
|
|
|
@ -224,7 +224,7 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
|
|||
{
|
||||
DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index));
|
||||
|
||||
if (i->index < 0 || i->index >= HEXIUM_INPUTS)
|
||||
if (i->index >= HEXIUM_INPUTS)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input));
|
||||
|
|
|
@ -325,7 +325,7 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
|
|||
{
|
||||
DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index));
|
||||
|
||||
if (i->index < 0 || i->index >= HEXIUM_INPUTS)
|
||||
if (i->index >= HEXIUM_INPUTS)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input));
|
||||
|
|
|
@ -709,7 +709,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
|
|||
else if (itv->has_cx23415 && regs->reg >= IVTV_DECODER_OFFSET &&
|
||||
regs->reg < IVTV_DECODER_OFFSET + IVTV_DECODER_SIZE)
|
||||
reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
|
||||
else if (regs->reg >= 0 && regs->reg < IVTV_ENCODER_SIZE)
|
||||
else if (regs->reg < IVTV_ENCODER_SIZE)
|
||||
reg_start = itv->enc_mem;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
|
|
@ -453,7 +453,7 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc)
|
|||
static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
|
||||
{
|
||||
DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index));
|
||||
if (i->index < 0 || i->index >= MXB_INPUTS)
|
||||
if (i->index >= MXB_INPUTS)
|
||||
return -EINVAL;
|
||||
memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input));
|
||||
return 0;
|
||||
|
@ -616,7 +616,7 @@ static int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a)
|
|||
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
|
||||
struct mxb *mxb = (struct mxb *)dev->ext_priv;
|
||||
|
||||
if (a->index < 0 || a->index > MXB_INPUTS) {
|
||||
if (a->index > MXB_INPUTS) {
|
||||
DEB_D(("VIDIOC_G_AUDIO %d out of range.\n", a->index));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
memset(&tmp,0,sizeof(tmp));
|
||||
tmp.index = vi->index;
|
||||
ret = 0;
|
||||
if ((vi->index < 0) || (vi->index >= fh->input_cnt)) {
|
||||
if (vi->index >= fh->input_cnt) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
case VIDIOC_S_INPUT:
|
||||
{
|
||||
struct v4l2_input *vi = (struct v4l2_input *)arg;
|
||||
if ((vi->index < 0) || (vi->index >= fh->input_cnt)) {
|
||||
if (vi->index >= fh->input_cnt) {
|
||||
ret = -ERANGE;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1107,7 +1107,7 @@ long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
return -EINVAL;
|
||||
if (buf->memory != V4L2_MEMORY_MMAP)
|
||||
return -EINVAL;
|
||||
if (buf->index < 0 || buf->index >= pwc_mbufs)
|
||||
if (buf->index >= pwc_mbufs)
|
||||
return -EINVAL;
|
||||
|
||||
buf->flags |= V4L2_BUF_FLAG_QUEUED;
|
||||
|
|
|
@ -1137,7 +1137,7 @@ static int stk_vidioc_querybuf(struct file *filp,
|
|||
struct stk_camera *dev = priv;
|
||||
struct stk_sio_buffer *sbuf;
|
||||
|
||||
if (buf->index < 0 || buf->index >= dev->n_sbufs)
|
||||
if (buf->index >= dev->n_sbufs)
|
||||
return -EINVAL;
|
||||
sbuf = dev->sio_bufs + buf->index;
|
||||
*buf = sbuf->v4lbuf;
|
||||
|
@ -1154,7 +1154,7 @@ static int stk_vidioc_qbuf(struct file *filp,
|
|||
if (buf->memory != V4L2_MEMORY_MMAP)
|
||||
return -EINVAL;
|
||||
|
||||
if (buf->index < 0 || buf->index >= dev->n_sbufs)
|
||||
if (buf->index >= dev->n_sbufs)
|
||||
return -EINVAL;
|
||||
sbuf = dev->sio_bufs + buf->index;
|
||||
if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED)
|
||||
|
|
|
@ -541,7 +541,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
|
|||
struct usb_usbvision *usbvision = video_drvdata(file);
|
||||
int chan;
|
||||
|
||||
if ((vi->index >= usbvision->video_inputs) || (vi->index < 0) )
|
||||
if (vi->index >= usbvision->video_inputs)
|
||||
return -EINVAL;
|
||||
if (usbvision->have_tuner) {
|
||||
chan = vi->index;
|
||||
|
|
|
@ -455,7 +455,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
|
|||
dprintk(1, "querybuf: Wrong type.\n");
|
||||
goto done;
|
||||
}
|
||||
if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) {
|
||||
if (unlikely(b->index >= VIDEO_MAX_FRAME)) {
|
||||
dprintk(1, "querybuf: index out of range.\n");
|
||||
goto done;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ int videobuf_qbuf(struct videobuf_queue *q,
|
|||
dprintk(1, "qbuf: Wrong type.\n");
|
||||
goto done;
|
||||
}
|
||||
if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) {
|
||||
if (b->index >= VIDEO_MAX_FRAME) {
|
||||
dprintk(1, "qbuf: index out of range.\n");
|
||||
goto done;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue