V4L/DVB: cx88: improve error handling
authorDan Carpenter <error27@gmail.com>
Fri, 2 Apr 2010 11:31:50 +0000 (08:31 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:57:31 +0000 (12:57 -0300)
Return -EINVAL if we don't find the right query control id.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx88/cx88-video.c

index f5d1d89bdc265f6a0450e74ea115487bfb69b5a6..0fab65c3ab392c6293b7393821e548bea4391b25 100644 (file)
@@ -1538,9 +1538,12 @@ static int radio_queryctrl (struct file *file, void *priv,
                c->id >= V4L2_CID_LASTP1)
                return -EINVAL;
        if (c->id == V4L2_CID_AUDIO_MUTE) {
-               for (i = 0; i < CX8800_CTLS; i++)
+               for (i = 0; i < CX8800_CTLS; i++) {
                        if (cx8800_ctls[i].v.id == c->id)
                                break;
+               }
+               if (i == CX8800_CTLS)
+                       return -EINVAL;
                *c = cx8800_ctls[i].v;
        } else
                *c = no_ctl;