[media] saa7134: add test after for loop

Add a check after the for loops to see if we found what we were looking
for or if we reached the end of the list.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Dan Carpenter 2010-10-04 16:28:01 -03:00 committed by Mauro Carvalho Chehab
parent 8a197fcc31
commit 06e6588edf
1 changed files with 8 additions and 2 deletions

View File

@ -1871,10 +1871,13 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_
else else
fixup = V4L2_STD_SECAM; fixup = V4L2_STD_SECAM;
} }
for (i = 0; i < TVNORMS; i++) for (i = 0; i < TVNORMS; i++) {
if (fixup == tvnorms[i].id) if (fixup == tvnorms[i].id)
break; break;
} }
if (i == TVNORMS)
return -EINVAL;
}
*id = tvnorms[i].id; *id = tvnorms[i].id;
@ -1997,9 +2000,12 @@ static int saa7134_g_tuner(struct file *file, void *priv,
if (0 != t->index) if (0 != t->index)
return -EINVAL; return -EINVAL;
memset(t, 0, sizeof(*t)); memset(t, 0, sizeof(*t));
for (n = 0; n < SAA7134_INPUT_MAX; n++) for (n = 0; n < SAA7134_INPUT_MAX; n++) {
if (card_in(dev, n).tv) if (card_in(dev, n).tv)
break; break;
}
if (n == SAA7134_INPUT_MAX)
return -EINVAL;
if (NULL != card_in(dev, n).name) { if (NULL != card_in(dev, n).name) {
strcpy(t->name, "Television"); strcpy(t->name, "Television");
t->type = V4L2_TUNER_ANALOG_TV; t->type = V4L2_TUNER_ANALOG_TV;