Commit 09ca38a5 authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Mauro Carvalho Chehab

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: default avatarDafna Hirschfeld <dafna3@gmail.com>
Reviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 4d10452c
......@@ -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);
......
......@@ -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);
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment