diff options
author | Christophe Jaillet <christophe.jaillet@wanadoo.fr> | 2008-05-20 19:33:06 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-05-20 16:51:20 -0400 |
commit | eccf2144e1232c33a8235033ffa079b6ebf92faf (patch) | |
tree | 870dece32d3a26405f335884ffee0276d23f4a65 /drivers/dma | |
parent | 76b0c788e6033c514f2a75171b04c73c68d28e8d (diff) |
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: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/iop-adma.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 762b729672e0..0ec0f431e6a1 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
821 | 821 | ||
822 | dev_dbg(device->common.dev, "%s\n", __func__); | 822 | dev_dbg(device->common.dev, "%s\n", __func__); |
823 | 823 | ||
824 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 824 | src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
825 | if (!src) | 825 | if (!src) |
826 | return -ENOMEM; | 826 | return -ENOMEM; |
827 | dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 827 | dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
828 | if (!dest) { | 828 | if (!dest) { |
829 | kfree(src); | 829 | kfree(src); |
830 | return -ENOMEM; | 830 | return -ENOMEM; |
@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) | 834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) |
835 | ((u8 *) src)[i] = (u8)i; | 835 | ((u8 *) src)[i] = (u8)i; |
836 | 836 | ||
837 | memset(dest, 0, IOP_ADMA_TEST_SIZE); | ||
838 | |||
839 | /* Start copy, using first DMA channel */ | 837 | /* Start copy, using first DMA channel */ |
840 | dma_chan = container_of(device->common.channels.next, | 838 | dma_chan = container_of(device->common.channels.next, |
841 | struct dma_chan, | 839 | struct dma_chan, |