public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] videobuf-dma-sg.c : not need memset()
@ 2009-06-03  2:13 Figo.zhang
  2009-06-16 16:38 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 2+ messages in thread
From: Figo.zhang @ 2009-06-03  2:13 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, Hans Verkuil, Trent Piepho

mem have malloc zero memory by kzalloc(), so it have not need to 
memset().
 
Signed-off-by: Figo.zhang <figo1802@gmail.com>
--- 
 drivers/media/video/videobuf-dma-sg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index da1790e..add2f34 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -420,7 +420,7 @@ static void *__videobuf_alloc(size_t size)
 	mem = vb->priv = ((char *)vb)+size;
 	mem->magic=MAGIC_SG_MEM;
 
-	videobuf_dma_init(&mem->dma);
+	mem->dma.magic = MAGIC_DMABUF;
 
 	dprintk(1,"%s: allocated at %p(%ld+%ld) & %p(%ld)\n",
 		__func__,vb,(long)sizeof(*vb),(long)size-sizeof(*vb),



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

* Re: [PATCH] videobuf-dma-sg.c : not need memset()
  2009-06-03  2:13 [PATCH] videobuf-dma-sg.c : not need memset() Figo.zhang
@ 2009-06-16 16:38 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2009-06-16 16:38 UTC (permalink / raw)
  To: Figo.zhang; +Cc: linux-media, Hans Verkuil, Trent Piepho

Fingo,

Em Wed, 03 Jun 2009 10:13:44 +0800
"Figo.zhang" <figo1802@gmail.com> escreveu:

> mem have malloc zero memory by kzalloc(), so it have not need to 
> memset().
>  
> Signed-off-by: Figo.zhang <figo1802@gmail.com>
> --- 
>  drivers/media/video/videobuf-dma-sg.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
> index da1790e..add2f34 100644
> --- a/drivers/media/video/videobuf-dma-sg.c
> +++ b/drivers/media/video/videobuf-dma-sg.c
> @@ -420,7 +420,7 @@ static void *__videobuf_alloc(size_t size)
>  	mem = vb->priv = ((char *)vb)+size;
>  	mem->magic=MAGIC_SG_MEM;
>  
> -	videobuf_dma_init(&mem->dma);
> +	mem->dma.magic = MAGIC_DMABUF;

Technically, this patch is correct. However, I'm afraid that a future change at
videobuf_dma_init could cause a breakage. IMO, if we do such change, the better
would be to split videobuf_dma_init into two functions or to add a comment at
the code warning that this should match the init done at videobuf_dma_init.

>  
>  	dprintk(1,"%s: allocated at %p(%ld+%ld) & %p(%ld)\n",
>  		__func__,vb,(long)sizeof(*vb),(long)size-sizeof(*vb),
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 

Cheers,
Mauro

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

end of thread, other threads:[~2009-06-16 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-03  2:13 [PATCH] videobuf-dma-sg.c : not need memset() Figo.zhang
2009-06-16 16:38 ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox