Christophe Jaillet wrote:
> From: Christophe Jaillet
>
> 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'
>
> Signed-off-by: Christophe Jaillet
>
> ---
>
> --- linux/drivers/dma/iop-adma.c 2008-04-17 04:49:44.000000000 +0200
> +++ linux/drivers/dma/iop-adma.c.cj 2008-05-12 22:39:14.000000000 +0200
> @@ -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;
> @@ -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,


Acked-by: Maciej Sosnowski
---------------------------------------------------------------------
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/