From: Stephen Boyd Date: Fri, 23 Mar 2018 16:34:51 +0000 (-0700) Subject: gpiolib: Change bitmap allocation to kmalloc_array X-Git-Tag: v4.17-rc1~121^2~4^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ace56935ff48879239d79129c7882ea2ff1b4804;p=thirdparty%2Flinux.git gpiolib: Change bitmap allocation to kmalloc_array We don't need to clear out these bits when we set them immediately after. Use kmalloc_array() to skip clearing the bits. Suggested-by: Andy Shevchenko Signed-off-by: Stephen Boyd Tested-by: Timur Tabi Reviewed-by: Andy Shevchenko Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index cc0e1519da459..db3788d17ba0e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -341,7 +341,7 @@ static unsigned long *gpiochip_allocate_mask(struct gpio_chip *chip) { unsigned long *p; - p = kcalloc(BITS_TO_LONGS(chip->ngpio), sizeof(long), GFP_KERNEL); + p = kmalloc_array(BITS_TO_LONGS(chip->ngpio), sizeof(*p), GFP_KERNEL); if (!p) return NULL;