From: Hui Su Date: Tue, 13 Oct 2020 23:56:52 +0000 (-0700) Subject: mm/z3fold.c: use xx_zalloc instead xx_alloc and memset X-Git-Tag: v5.10.7~1450^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f94afee9980c5722dfff6d3e46fd34a36293a509;p=platform%2Fkernel%2Flinux-rpi.git mm/z3fold.c: use xx_zalloc instead xx_alloc and memset alloc_slots() allocates memory for slots using kmem_cache_alloc(), then memsets it. We can just use kmem_cache_zalloc(). Signed-off-by: Hui Su Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Link: https://lkml.kernel.org/r/20200926100834.GA184671@rlk Signed-off-by: Linus Torvalds --- diff --git a/mm/z3fold.c b/mm/z3fold.c index 460b0fe..18feaa0 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -212,13 +212,12 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool, { struct z3fold_buddy_slots *slots; - slots = kmem_cache_alloc(pool->c_handle, + slots = kmem_cache_zalloc(pool->c_handle, (gfp & ~(__GFP_HIGHMEM | __GFP_MOVABLE))); if (slots) { /* It will be freed separately in free_handle(). */ kmemleak_not_leak(slots); - memset(slots->slot, 0, sizeof(slots->slot)); slots->pool = (unsigned long)pool; rwlock_init(&slots->lock); }