Skip to contentSkip to conversation

dma:

PATCH Applied Sosnowski, Maciej 2 participants 2 messages May 13, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Sosnowski, Maciej

author Acked-by
#1 lore raw
Quoted 36 lines · Christophe Jaillet

From: Christophe Jaillet <[email protected]>

Hi, here is a patch against linux/drivers/dma/iop-adma.c which :

1) Remove an explicit memset(.., 0, ...) to a variable allocated with kzalloc (i.e. 'dest').

2) Allocate 'src' with kmalloc instead of kzalloc as all elements of the 'src' buffer are initialized in a 'for(...)' loop just after.

3) remove useless 'sizeof(u8)', which always returns 1, when computing the size of the memory to be allocated.

Note: this patch is based on 'linux-2.6.25.tar.bz2'

---

drivers/dma/iop-adma.c.cj renamed from drivers/dma/iop-adma.c +2 -2
@@ -825,10 +825,10 @@ static int __devinit iop_adma_memcpy_sel
 
 	dev_dbg(device->common.dev, "%s\n", __func__);
 
-	src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL);
+	src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);
 	if (!src)
 		return -ENOMEM;
-	dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL);
+	dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);
 	if (!dest) {
 		kfree(src);
 		return -ENOMEM;

drivers/dma/iop-adma.c.cj static int __devinit iop_adma_memcpy_sel · line 843

Quoted 8 lines
drivers/dma/iop-adma.c.cj renamed from drivers/dma/iop-adma.c +0 -2
@@ -838,8 +838,6 @@ static int __devinit iop_adma_memcpy_sel
 	for (i = 0; i < IOP_ADMA_TEST_SIZE; i++)
 		((u8 *) src)[i] = (u8)i;
 
-	memset(dest, 0, IOP_ADMA_TEST_SIZE);
-
 	/* Start copy, using first DMA channel */
 	dma_chan = container_of(device->common.channels.next,
 				struct dma_chan,

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk

Sad Rejonowy Gdansk Polnoc w Gdansku,
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, numer KRS 101882

NIP 957-07-52-316
Kapital zakladowy 200.000 zl

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Applied
#2 lore raw
In reply to a message not in the archive
Quoted 11 lines · Christophe Jaillet

From: Christophe Jaillet <[email protected]>

Hi, here is a patch against linux/drivers/dma/iop-adma.c which :

1) Remove an explicit memset(.., 0, ...) to a variable allocated with kzalloc (i.e. 'dest').

2) Allocate 'src' with kmalloc instead of kzalloc as all elements of the
'src' buffer are initialized in a 'for(...)' loop just after.

Quoted 8 lines

3) remove useless 'sizeof(u8)', which always returns 1, when computing the
size of the memory to be allocated.

Note: this patch is based on 'linux-2.6.25.tar.bz2'

Thanks, applied.

--
Dan