pwm: Use kcalloc() instead of kzalloc()
authorThierry Reding <thierry.reding@gmail.com>
Mon, 2 May 2016 10:07:34 +0000 (12:07 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 3 May 2016 11:57:05 +0000 (13:57 +0200)
kcalloc() should be preferred for allocations of arrays over kzalloc()
with multiplication.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/core.c

index bc0c20a..2a1a2d5 100644 (file)
@@ -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;