]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
xen/blkback: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 27 Aug 2012 04:28:57 +0000 (12:28 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Oct 2012 07:36:27 +0000 (08:36 +0100)
Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/xenbus.c

index d0fed5582a42d66b40ff56c32b8251b6278c170a..f58434c2617cab4185b8c049804f1031f4226a6e 100644 (file)
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
 {
        struct xen_blkif *blkif;
 
-       blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL);
+       blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL);
        if (!blkif)
                return ERR_PTR(-ENOMEM);
 
-       memset(blkif, 0, sizeof(*blkif));
        blkif->domid = domid;
        spin_lock_init(&blkif->blk_ring_lock);
        atomic_set(&blkif->refcnt, 1);