From: Markus Elfring Date: Sun, 8 Jan 2017 20:43:12 +0000 (+0100) Subject: mmc: mmc_test: Use kcalloc() in mmc_test_alloc_mem() X-Git-Tag: Ubuntu-5.10.0-12.13~10876^2~104 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3972a20b51c8bb887d13f5656d6fa93bf3d4fc46;p=mirror_ubuntu-hirsute-kernel.git mmc: mmc_test: Use kcalloc() in mmc_test_alloc_mem() * The script "checkpatch.pl" pointed information out like the following. WARNING: Prefer kcalloc over kzalloc with multiply Thus fix the affected source code place. * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Reviewed-by: Linus Walleij Reviewed-by: Shawn Lin Reviewed-by: Andy Shevchenko Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 7784cce56895..d350bd67b4f8 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -360,8 +360,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz, if (!mem) return NULL; - mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_segs, - GFP_KERNEL); + mem->arr = kcalloc(max_segs, sizeof(*mem->arr), GFP_KERNEL); if (!mem->arr) goto out_free;