diff options
author | Dan Carpenter <error27@gmail.com> | 2010-03-28 08:49:20 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 12:57:26 -0300 |
commit | f24350b48eed2d5518a5f0c2c95d51a655387457 (patch) | |
tree | 47ee834fc868de1d31680328556bcdc15398550c | |
parent | a9fac6b1487aea9f5aaefe93def522fab477f5dc (diff) | |
download | linux-f24350b48eed2d5518a5f0c2c95d51a655387457.tar.bz2 |
V4L/DVB: video/zc0301: improve error handling
Return an error if the controller is not found.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/zc0301/zc0301_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index e44e4b5f3e50..bb51cfb0c647 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c @@ -1153,7 +1153,7 @@ zc0301_vidioc_s_ctrl(struct zc0301_device* cam, void __user * arg) if (copy_from_user(&ctrl, arg, sizeof(ctrl))) return -EFAULT; - for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) + for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) { if (ctrl.id == s->qctrl[i].id) { if (s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED) return -EINVAL; @@ -1163,7 +1163,9 @@ zc0301_vidioc_s_ctrl(struct zc0301_device* cam, void __user * arg) ctrl.value -= ctrl.value % s->qctrl[i].step; break; } - + } + if (i == ARRAY_SIZE(s->qctrl)) + return -EINVAL; if ((err = s->set_ctrl(cam, &ctrl))) return err; |