aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-28 07:49:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:26 -0400
commitf24350b48eed2d5518a5f0c2c95d51a655387457 (patch)
tree47ee834fc868de1d31680328556bcdc15398550c
parenta9fac6b1487aea9f5aaefe93def522fab477f5dc (diff)
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.c6
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)
1153 if (copy_from_user(&ctrl, arg, sizeof(ctrl))) 1153 if (copy_from_user(&ctrl, arg, sizeof(ctrl)))
1154 return -EFAULT; 1154 return -EFAULT;
1155 1155
1156 for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) 1156 for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) {
1157 if (ctrl.id == s->qctrl[i].id) { 1157 if (ctrl.id == s->qctrl[i].id) {
1158 if (s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED) 1158 if (s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED)
1159 return -EINVAL; 1159 return -EINVAL;
@@ -1163,7 +1163,9 @@ zc0301_vidioc_s_ctrl(struct zc0301_device* cam, void __user * arg)
1163 ctrl.value -= ctrl.value % s->qctrl[i].step; 1163 ctrl.value -= ctrl.value % s->qctrl[i].step;
1164 break; 1164 break;
1165 } 1165 }
1166 1166 }
1167 if (i == ARRAY_SIZE(s->qctrl))
1168 return -EINVAL;
1167 if ((err = s->set_ctrl(cam, &ctrl))) 1169 if ((err = s->set_ctrl(cam, &ctrl)))
1168 return err; 1170 return err;
1169 1171