media: v4l2-ctrl: v4l2_ctrl_request_setup returns with error upon failure

If one of the controls fails to set,
then 'v4l2_ctrl_request_setup'
immediately returns with the error code.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Dafna Hirschfeld 2019-03-06 16:13:26 -05:00 committed by Mauro Carvalho Chehab
parent 4d10452cd1
commit 09ca38a507
2 changed files with 12 additions and 8 deletions

View File

@ -3899,18 +3899,19 @@ void v4l2_ctrl_request_complete(struct media_request *req,
}
EXPORT_SYMBOL(v4l2_ctrl_request_complete);
void v4l2_ctrl_request_setup(struct media_request *req,
int v4l2_ctrl_request_setup(struct media_request *req,
struct v4l2_ctrl_handler *main_hdl)
{
struct media_request_object *obj;
struct v4l2_ctrl_handler *hdl;
struct v4l2_ctrl_ref *ref;
int ret = 0;
if (!req || !main_hdl)
return;
return 0;
if (WARN_ON(req->state != MEDIA_REQUEST_STATE_QUEUED))
return;
return -EBUSY;
/*
* Note that it is valid if nothing was found. It means
@ -3919,10 +3920,10 @@ void v4l2_ctrl_request_setup(struct media_request *req,
*/
obj = media_request_object_find(req, &req_ops, main_hdl);
if (!obj)
return;
return 0;
if (obj->completed) {
media_request_object_put(obj);
return;
return -EBUSY;
}
hdl = container_of(obj, struct v4l2_ctrl_handler, req_obj);
@ -3990,12 +3991,15 @@ void v4l2_ctrl_request_setup(struct media_request *req,
update_from_auto_cluster(master);
}
try_or_set_cluster(NULL, master, true, 0);
ret = try_or_set_cluster(NULL, master, true, 0);
v4l2_ctrl_unlock(master);
if (ret)
break;
}
media_request_object_put(obj);
return ret;
}
EXPORT_SYMBOL(v4l2_ctrl_request_setup);

View File

@ -1127,7 +1127,7 @@ __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
* applying control values in a request is only applicable to memory-to-memory
* devices.
*/
void v4l2_ctrl_request_setup(struct media_request *req,
int v4l2_ctrl_request_setup(struct media_request *req,
struct v4l2_ctrl_handler *parent);
/**