Skip to contentSkip to conversation

videobuf-dma-sg.c : not need memset()

PATCH In review Figo.zhang 2 participants 2 messages Jun 3, 2009 – Jun 16, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Figo.zhang

author
#0 lore raw

PATCH 1/1 videobuf-dma-sg.c : not need memset()

mem have malloc zero memory by kzalloc(), so it have not need to memset().

---

 drivers/media/video/videobuf-dma-sg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/videobuf-dma-sg.c +1 -1
index da1790e..add2f34 100644
@@ -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),
#1 lore raw

Fingo,

Em Wed, 03 Jun 2009 10:13:44 +0800
"Figo.zhang" <[email protected]> escreveu:

Quoted 13 lines

mem have malloc zero memory by kzalloc(), so it have not need to memset().

---

 drivers/media/video/videobuf-dma-sg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/videobuf-dma-sg.c +0 -0
index da1790e..add2f34 100644

drivers/media/video/videobuf-dma-sg.c static void *__videobuf_alloc(size_t size) · line 423

Quoted 5 lines
drivers/media/video/videobuf-dma-sg.c +1 -1
@@ -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.

Quoted 9 lines
drivers/media/video/videobuf-dma-sg.c +0 -1
 	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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Cheers,
Mauro