Commit 864c051b authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Greg Kroah-Hartman

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

[ Upstream commit 09ca38a5 ]

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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 75224c88
...@@ -3899,18 +3899,19 @@ void v4l2_ctrl_request_complete(struct media_request *req, ...@@ -3899,18 +3899,19 @@ void v4l2_ctrl_request_complete(struct media_request *req,
} }
EXPORT_SYMBOL(v4l2_ctrl_request_complete); 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 v4l2_ctrl_handler *main_hdl)
{ {
struct media_request_object *obj; struct media_request_object *obj;
struct v4l2_ctrl_handler *hdl; struct v4l2_ctrl_handler *hdl;
struct v4l2_ctrl_ref *ref; struct v4l2_ctrl_ref *ref;
int ret = 0;
if (!req || !main_hdl) if (!req || !main_hdl)
return; return 0;
if (WARN_ON(req->state != MEDIA_REQUEST_STATE_QUEUED)) if (WARN_ON(req->state != MEDIA_REQUEST_STATE_QUEUED))
return; return -EBUSY;
/* /*
* Note that it is valid if nothing was found. It means * Note that it is valid if nothing was found. It means
...@@ -3919,10 +3920,10 @@ void v4l2_ctrl_request_setup(struct media_request *req, ...@@ -3919,10 +3920,10 @@ void v4l2_ctrl_request_setup(struct media_request *req,
*/ */
obj = media_request_object_find(req, &req_ops, main_hdl); obj = media_request_object_find(req, &req_ops, main_hdl);
if (!obj) if (!obj)
return; return 0;
if (obj->completed) { if (obj->completed) {
media_request_object_put(obj); media_request_object_put(obj);
return; return -EBUSY;
} }
hdl = container_of(obj, struct v4l2_ctrl_handler, req_obj); hdl = container_of(obj, struct v4l2_ctrl_handler, req_obj);
...@@ -3990,12 +3991,15 @@ void v4l2_ctrl_request_setup(struct media_request *req, ...@@ -3990,12 +3991,15 @@ void v4l2_ctrl_request_setup(struct media_request *req,
update_from_auto_cluster(master); 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); v4l2_ctrl_unlock(master);
if (ret)
break;
} }
media_request_object_put(obj); media_request_object_put(obj);
return ret;
} }
EXPORT_SYMBOL(v4l2_ctrl_request_setup); EXPORT_SYMBOL(v4l2_ctrl_request_setup);
......
...@@ -1127,7 +1127,7 @@ __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait); ...@@ -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 * applying control values in a request is only applicable to memory-to-memory
* devices. * devices.
*/ */
void v4l2_ctrl_request_setup(struct media_request *req, int v4l2_ctrl_request_setup(struct media_request *req,
struct v4l2_ctrl_handler *parent); 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