Re: [REVIEWv7 PATCH 04/12] vb2: don't free alloc context if it is ERR_PTR

2014-11-26 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 18 November 2014 13:51:00 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Don't try to free a pointer containing an ERR_PTR().

Wouldn't it be easier to return NULL from vb2_dma_contig_alloc_ctx() instead 
of an ERR_PTR ?

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/videobuf2-dma-contig.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c
 b/drivers/media/v4l2-core/videobuf2-dma-contig.c index c4305bf..0bfc488
 100644
 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
 +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
 @@ -854,7 +854,8 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx);
 
  void vb2_dma_contig_cleanup_ctx(void *alloc_ctx)
  {
 - kfree(alloc_ctx);
 + if (!IS_ERR_OR_NULL(alloc_ctx))
 + kfree(alloc_ctx);
  }
  EXPORT_SYMBOL_GPL(vb2_dma_contig_cleanup_ctx);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [REVIEWv7 PATCH 04/12] vb2: don't free alloc context if it is ERR_PTR

2014-11-23 Thread Pawel Osciak
On Tue, Nov 18, 2014 at 9:51 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Don't try to free a pointer containing an ERR_PTR().

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Acked-by: Pawel Osciak pa...@osciak.com

-- 
Best regards,
Pawel Osciak
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEWv7 PATCH 04/12] vb2: don't free alloc context if it is ERR_PTR

2014-11-18 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Don't try to free a pointer containing an ERR_PTR().

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index c4305bf..0bfc488 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -854,7 +854,8 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx);
 
 void vb2_dma_contig_cleanup_ctx(void *alloc_ctx)
 {
-   kfree(alloc_ctx);
+   if (!IS_ERR_OR_NULL(alloc_ctx))
+   kfree(alloc_ctx);
 }
 EXPORT_SYMBOL_GPL(vb2_dma_contig_cleanup_ctx);
 
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html