From: Thierry Reding Date: Mon, 2 May 2016 10:07:34 +0000 (+0200) Subject: UPSTREAM: pwm: Use kcalloc() instead of kzalloc() X-Git-Tag: firefly_0821_release~455 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5818f819cca318bdb13dc8a0f427100d2c12f077;p=firefly-linux-kernel-4.4.55.git UPSTREAM: pwm: Use kcalloc() instead of kzalloc() kcalloc() should be preferred for allocations of arrays over kzalloc() with multiplication. Signed-off-by: Thierry Reding (cherry picked from commit 2907f8abb7ec3aec85ceaaf03dfbc16cca0018dc) Change-Id: Ifa4619bcd5c0869e516ae7765bab7515b299c533 Signed-off-by: David Wu --- diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 5c961c640823..8fbd7c5d34b6 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -262,7 +262,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;