summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2020-03-19 10:16:30 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-03-20 09:05:25 +0100
commit75a0359f29435df5d44fce307a06aab73fa6ae08 (patch)
treeaf24c4f0a89e99d88ecb6105f73a82aa0b6335f5
parent8082d0a33cbae16d268639586a38cf080777d791 (diff)
media: staging: allegro: fix broken registration of controls
Since commit cc62c74749a3 ("media: allegro: add missed checks in allegro_open()") the allegro device does provide v4l2 controls to user space anymore. The reason is that v4l2_fh_init() initializes fh->ctrl_handler to vdev->ctrl_handler, which invalidates the previous driver override of the ctrl_handler. Therefore, v4l2_fh_init() must be called before the driver overrides the fh->ctrl_handler with its own handler. Move the initialization of the fh back to the top, as the initialization does not does not need to be reverted on errors, but it is enough to free the channel. Fixes: cc62c74749a3 ("media: allegro: add missed checks in allegro_open()") Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
index 3c949090e8d2..218164158a04 100644
--- a/drivers/staging/media/allegro-dvt/allegro-core.c
+++ b/drivers/staging/media/allegro-dvt/allegro-core.c
@@ -2276,6 +2276,8 @@ static int allegro_open(struct file *file)
if (!channel)
return -ENOMEM;
+ v4l2_fh_init(&channel->fh, vdev);
+
init_completion(&channel->completion);
channel->dev = dev;
@@ -2348,7 +2350,6 @@ static int allegro_open(struct file *file)
goto error;
}
- v4l2_fh_init(&channel->fh, vdev);
file->private_data = &channel->fh;
v4l2_fh_add(&channel->fh);