Commit eccf2144 authored by Christophe Jaillet's avatar Christophe Jaillet Committed by Dan Williams

iop-adma: fixup some kzalloc/memset confusions

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.
Signed-off-by: default avatarChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 76b0c788
...@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) ...@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
dev_dbg(device->common.dev, "%s\n", __func__); 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) if (!src)
return -ENOMEM; return -ENOMEM;
dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);
if (!dest) { if (!dest) {
kfree(src); kfree(src);
return -ENOMEM; return -ENOMEM;
...@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) ...@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) for (i = 0; i < IOP_ADMA_TEST_SIZE; i++)
((u8 *) src)[i] = (u8)i; ((u8 *) src)[i] = (u8)i;
memset(dest, 0, IOP_ADMA_TEST_SIZE);
/* Start copy, using first DMA channel */ /* Start copy, using first DMA channel */
dma_chan = container_of(device->common.channels.next, dma_chan = container_of(device->common.channels.next,
struct dma_chan, struct dma_chan,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment