From: Markus Elfring <[email protected]>
Date: Tue, 18 Apr 2017 17:00:39 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_kcalloc".

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <[email protected]>
---
 drivers/acpi/fan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 6cf4988206f2..92878c7c523b 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -298,8 +298,7 @@ static int acpi_fan_get_fps(struct acpi_device *device)
        }
 
        fan->fps_count = obj->package.count - 1; /* minus revision field */
-       fan->fps = devm_kzalloc(&device->dev,
-                               fan->fps_count * sizeof(struct acpi_fan_fps),
+       fan->fps = devm_kcalloc(&device->dev, fan->fps_count, sizeof(*fan->fps),
                                GFP_KERNEL);
        if (!fan->fps) {
                dev_err(&device->dev, "Not enough memory\n");
-- 
2.12.2


Reply via email to