From 2907f8abb7ec3aec85ceaaf03dfbc16cca0018dc Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Mon, 2 May 2016 12:07:34 +0200 Subject: [PATCH] pwm: Use kcalloc() instead of kzalloc() kcalloc() should be preferred for allocations of arrays over kzalloc() with multiplication. Signed-off-by: Thierry Reding --- drivers/pwm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index bc0c20ac90a1..2a1a2d566e39 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -255,7 +255,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip, if (ret < 0) goto out; - chip->pwms = kzalloc(chip->npwm * sizeof(*pwm), GFP_KERNEL); + chip->pwms = kcalloc(chip->npwm, sizeof(*pwm), GFP_KERNEL); if (!chip->pwms) { ret = -ENOMEM; goto out; -- 2.20.1