diff mbox series

[2/2] media: staging/intel-ipu3: Cleanup dummy buffers via helper

Message ID 20220318121826.877187-3-umang.jain@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: ipu3: Sequence number fix and improvements | expand

Commit Message

Umang Jain March 18, 2022, 12:18 p.m. UTC
Use an existing helper imgu_video_nodes_exit() on imgu-video-node
initialization failure path to cleanup dummy buffers.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 drivers/staging/media/ipu3/ipu3.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

Comments

Laurent Pinchart March 22, 2022, 11:23 p.m. UTC | #1
Hi Umang,

Thank you for the patch.

On Fri, Mar 18, 2022 at 05:48:26PM +0530, Umang Jain via libcamera-devel wrote:
> Use an existing helper imgu_video_nodes_exit() on imgu-video-node
> initialization failure path to cleanup dummy buffers.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/staging/media/ipu3/ipu3.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c
> index 8e1e9e46e604..0c453b37f8c4 100644
> --- a/drivers/staging/media/ipu3/ipu3.c
> +++ b/drivers/staging/media/ipu3/ipu3.c
> @@ -440,6 +440,16 @@ int imgu_s_stream(struct imgu_device *imgu, int enable)
>  	return r;
>  }
>  
> +static void imgu_video_nodes_exit(struct imgu_device *imgu)
> +{
> +	int i;
> +
> +	for (i = 0; i < IMGU_MAX_PIPE_NUM; i++)
> +		imgu_dummybufs_cleanup(imgu, i);
> +
> +	imgu_v4l2_unregister(imgu);
> +}
> +
>  static int imgu_video_nodes_init(struct imgu_device *imgu)
>  {
>  	struct v4l2_pix_format_mplane *fmts[IPU3_CSS_QUEUES] = { NULL };
> @@ -489,24 +499,11 @@ static int imgu_video_nodes_init(struct imgu_device *imgu)
>  	return 0;
>  
>  out_cleanup:
> -	for (j = 0; j < IMGU_MAX_PIPE_NUM; j++)
> -		imgu_dummybufs_cleanup(imgu, j);
> -
> -	imgu_v4l2_unregister(imgu);
> +	imgu_video_nodes_exit(imgu);
>  
>  	return r;
>  }
>  
> -static void imgu_video_nodes_exit(struct imgu_device *imgu)
> -{
> -	int i;
> -
> -	for (i = 0; i < IMGU_MAX_PIPE_NUM; i++)
> -		imgu_dummybufs_cleanup(imgu, i);
> -
> -	imgu_v4l2_unregister(imgu);
> -}
> -
>  /**************** PCI interface ****************/
>  
>  static irqreturn_t imgu_isr_threaded(int irq, void *imgu_ptr)
diff mbox series

Patch

diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c
index 8e1e9e46e604..0c453b37f8c4 100644
--- a/drivers/staging/media/ipu3/ipu3.c
+++ b/drivers/staging/media/ipu3/ipu3.c
@@ -440,6 +440,16 @@  int imgu_s_stream(struct imgu_device *imgu, int enable)
 	return r;
 }
 
+static void imgu_video_nodes_exit(struct imgu_device *imgu)
+{
+	int i;
+
+	for (i = 0; i < IMGU_MAX_PIPE_NUM; i++)
+		imgu_dummybufs_cleanup(imgu, i);
+
+	imgu_v4l2_unregister(imgu);
+}
+
 static int imgu_video_nodes_init(struct imgu_device *imgu)
 {
 	struct v4l2_pix_format_mplane *fmts[IPU3_CSS_QUEUES] = { NULL };
@@ -489,24 +499,11 @@  static int imgu_video_nodes_init(struct imgu_device *imgu)
 	return 0;
 
 out_cleanup:
-	for (j = 0; j < IMGU_MAX_PIPE_NUM; j++)
-		imgu_dummybufs_cleanup(imgu, j);
-
-	imgu_v4l2_unregister(imgu);
+	imgu_video_nodes_exit(imgu);
 
 	return r;
 }
 
-static void imgu_video_nodes_exit(struct imgu_device *imgu)
-{
-	int i;
-
-	for (i = 0; i < IMGU_MAX_PIPE_NUM; i++)
-		imgu_dummybufs_cleanup(imgu, i);
-
-	imgu_v4l2_unregister(imgu);
-}
-
 /**************** PCI interface ****************/
 
 static irqreturn_t imgu_isr_threaded(int irq, void *imgu_ptr)