OSDN Git Service

powerpc/cell: Use vzalloc rather than vmalloc and memset in spu_alloc_lscsa_std
authorJesper Juhl <jj@chaosbits.net>
Sat, 30 Oct 2010 08:10:41 +0000 (08:10 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 29 Nov 2010 04:48:21 +0000 (15:48 +1100)
Hi,

We can get rid of a memset in
arch/powerpc/platforms/cell/spufs/lscsa_alloc.c::spu_alloc_lscsa_std() by
using vzalloc() rather than vmalloc()+memset().

Completely untested patch below since I have no hardware nor tools to
compile this.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/cell/spufs/lscsa_alloc.c

index a101abf..3b894f5 100644 (file)
@@ -36,10 +36,9 @@ static int spu_alloc_lscsa_std(struct spu_state *csa)
        struct spu_lscsa *lscsa;
        unsigned char *p;
 
-       lscsa = vmalloc(sizeof(struct spu_lscsa));
+       lscsa = vzalloc(sizeof(struct spu_lscsa));
        if (!lscsa)
                return -ENOMEM;
-       memset(lscsa, 0, sizeof(struct spu_lscsa));
        csa->lscsa = lscsa;
 
        /* Set LS pages reserved to allow for user-space mapping. */