diff mbox series

[v3,8/8] ipu3-cio2: Remove traces of returned buffers

Message ID 20201012180414.11579-9-sakari.ailus@linux.intel.com
State Accepted
Commit 61e7f892b5ee1dd10ea8bff805f3c3fe6e535959
Headers show
Series [v3,1/8] ipu3-cio2: Return actual subdev format | expand

Commit Message

Sakari Ailus Oct. 12, 2020, 6:04 p.m. UTC
If starting a video buffer queue fails, the buffers are returned to
videobuf2. Remove the reference to the buffer from driver's queue as well.

Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: stable@vger.kernel.org # v4.16 and up
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Shevchenko Oct. 12, 2020, 6:32 p.m. UTC | #1
On Mon, Oct 12, 2020 at 9:07 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>

> If starting a video buffer queue fails, the buffers are returned to

> videobuf2. Remove the reference to the buffer from driver's queue as well.


the driver's

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> Cc: stable@vger.kernel.org # v4.16 and up

> ---

>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> index d9baa8bfe54f..51c4dd6a8f9a 100644

> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> @@ -791,6 +791,7 @@ static void cio2_vb2_return_all_buffers(struct cio2_queue *q,

>                         atomic_dec(&q->bufs_queued);

>                         vb2_buffer_done(&q->bufs[i]->vbb.vb2_buf,

>                                         state);

> +                       q->bufs[i] = NULL;

>                 }

>         }

>  }

> --

> 2.27.0

>



-- 
With Best Regards,
Andy Shevchenko
Laurent Pinchart Oct. 12, 2020, 6:35 p.m. UTC | #2
Hi Sakari,

Thank you for the patch.

On Mon, Oct 12, 2020 at 09:04:14PM +0300, Sakari Ailus wrote:
> If starting a video buffer queue fails, the buffers are returned to

> videobuf2. Remove the reference to the buffer from driver's queue as well.

> 

> Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> Cc: stable@vger.kernel.org # v4.16 and up

> ---

>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> index d9baa8bfe54f..51c4dd6a8f9a 100644

> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c

> @@ -791,6 +791,7 @@ static void cio2_vb2_return_all_buffers(struct cio2_queue *q,

>  			atomic_dec(&q->bufs_queued);

>  			vb2_buffer_done(&q->bufs[i]->vbb.vb2_buf,

>  					state);

> +			q->bufs[i] = NULL;


This looks good, and with Andy's comment addressed,

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


However, should we replace this with a linked list ?

>  		}

>  	}

>  }


-- 
Regards,

Laurent Pinchart
Sakari Ailus Oct. 13, 2020, 7:22 a.m. UTC | #3
On Mon, Oct 12, 2020 at 09:32:04PM +0300, Andy Shevchenko wrote:
> On Mon, Oct 12, 2020 at 9:07 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > If starting a video buffer queue fails, the buffers are returned to
> > videobuf2. Remove the reference to the buffer from driver's queue as well.
> 
> the driver's
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks for the review, Andy and Laurent!

I've fixed the commit messages and pushed the patches to my tree's master
branch.
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index d9baa8bfe54f..51c4dd6a8f9a 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -791,6 +791,7 @@  static void cio2_vb2_return_all_buffers(struct cio2_queue *q,
 			atomic_dec(&q->bufs_queued);
 			vb2_buffer_done(&q->bufs[i]->vbb.vb2_buf,
 					state);
+			q->bufs[i] = NULL;
 		}
 	}
 }