Explorar o código

pwm: Use kcalloc() instead of kzalloc()

kcalloc() should be preferred for allocations of arrays over kzalloc()
with multiplication.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Thierry Reding %!s(int64=9) %!d(string=hai) anos
pai
achega
2907f8abb7
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      drivers/pwm/core.c

+ 1 - 1
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;