diff options
author | Dan Carpenter <error27@gmail.com> | 2010-10-04 15:28:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 05:54:19 -0400 |
commit | 06e6588edfb2be6fb3e544097c07274bd7b64084 (patch) | |
tree | a76eb3b9b64d9b12adac36187f089a96413d0f78 /drivers/media/video/saa7134/saa7134-video.c | |
parent | 8a197fcc31d3eac0791eef6e92ce1a07d49bb3d3 (diff) |
[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>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index fae5e97a3eb2..f0b1573137f4 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1871,9 +1871,12 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_ | |||
1871 | else | 1871 | else |
1872 | fixup = V4L2_STD_SECAM; | 1872 | fixup = V4L2_STD_SECAM; |
1873 | } | 1873 | } |
1874 | for (i = 0; i < TVNORMS; i++) | 1874 | for (i = 0; i < TVNORMS; i++) { |
1875 | if (fixup == tvnorms[i].id) | 1875 | if (fixup == tvnorms[i].id) |
1876 | break; | 1876 | break; |
1877 | } | ||
1878 | if (i == TVNORMS) | ||
1879 | return -EINVAL; | ||
1877 | } | 1880 | } |
1878 | 1881 | ||
1879 | *id = tvnorms[i].id; | 1882 | *id = tvnorms[i].id; |
@@ -1997,9 +2000,12 @@ static int saa7134_g_tuner(struct file *file, void *priv, | |||
1997 | if (0 != t->index) | 2000 | if (0 != t->index) |
1998 | return -EINVAL; | 2001 | return -EINVAL; |
1999 | memset(t, 0, sizeof(*t)); | 2002 | memset(t, 0, sizeof(*t)); |
2000 | for (n = 0; n < SAA7134_INPUT_MAX; n++) | 2003 | for (n = 0; n < SAA7134_INPUT_MAX; n++) { |
2001 | if (card_in(dev, n).tv) | 2004 | if (card_in(dev, n).tv) |
2002 | break; | 2005 | break; |
2006 | } | ||
2007 | if (n == SAA7134_INPUT_MAX) | ||
2008 | return -EINVAL; | ||
2003 | if (NULL != card_in(dev, n).name) { | 2009 | if (NULL != card_in(dev, n).name) { |
2004 | strcpy(t->name, "Television"); | 2010 | strcpy(t->name, "Television"); |
2005 | t->type = V4L2_TUNER_ANALOG_TV; | 2011 | t->type = V4L2_TUNER_ANALOG_TV; |