All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: staging: allegro: fix broken registration of controls
@ 2020-03-19  9:16 Michael Tretter
  2020-04-14 10:35 ` Michael Tretter
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tretter @ 2020-03-19  9:16 UTC (permalink / raw)
  To: linux-media
  Cc: Hans Verkuil, Chuhong Yuan, Mauro Carvalho Chehab, kernel,
	Michael Tretter

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>
---
 drivers/staging/media/allegro-dvt/allegro-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
index cb6bdabaaff3..761f2c7ff8e7 100644
--- a/drivers/staging/media/allegro-dvt/allegro-core.c
+++ b/drivers/staging/media/allegro-dvt/allegro-core.c
@@ -2467,6 +2467,8 @@ static int allegro_open(struct file *file)
 	if (!channel)
 		return -ENOMEM;
 
+	v4l2_fh_init(&channel->fh, vdev);
+
 	init_completion(&channel->completion);
 	INIT_LIST_HEAD(&channel->source_shadow_list);
 	INIT_LIST_HEAD(&channel->stream_shadow_list);
@@ -2588,7 +2590,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);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: staging: allegro: fix broken registration of controls
  2020-03-19  9:16 [PATCH] media: staging: allegro: fix broken registration of controls Michael Tretter
@ 2020-04-14 10:35 ` Michael Tretter
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tretter @ 2020-04-14 10:35 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Chuhong Yuan, Mauro Carvalho Chehab, kernel

On Thu, Mar 19, 2020 at 10:16:30AM +0100, Michael Tretter wrote:
> 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.

Gentle ping.

Michael

> 
> Fixes: cc62c74749a3 ("media: allegro: add missed checks in allegro_open()")
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  drivers/staging/media/allegro-dvt/allegro-core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
> index cb6bdabaaff3..761f2c7ff8e7 100644
> --- a/drivers/staging/media/allegro-dvt/allegro-core.c
> +++ b/drivers/staging/media/allegro-dvt/allegro-core.c
> @@ -2467,6 +2467,8 @@ static int allegro_open(struct file *file)
>  	if (!channel)
>  		return -ENOMEM;
>  
> +	v4l2_fh_init(&channel->fh, vdev);
> +
>  	init_completion(&channel->completion);
>  	INIT_LIST_HEAD(&channel->source_shadow_list);
>  	INIT_LIST_HEAD(&channel->stream_shadow_list);
> @@ -2588,7 +2590,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);
>  
> -- 
> 2.20.1
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-14 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  9:16 [PATCH] media: staging: allegro: fix broken registration of controls Michael Tretter
2020-04-14 10:35 ` Michael Tretter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.