[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <930132d9-b878-e787-a67d-71113e5c211e@users.sourceforge.net>
Date: Tue, 18 Apr 2017 18:50:10 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-acpi@...r.kernel.org, Borislav Petkov <bp@...e.de>,
Chun-Yi Lee <joeyli.kernel@...il.com>,
Colin Ian King <colin.king@...onical.com>,
Dan Williams <dan.j.williams@...el.com>,
Len Brown <lenb@...nel.org>,
Linda Knippers <linda.knippers@....com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Tony Luck <tony.luck@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Zhang Rui <rui.zhang@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 1/6] ACPI-fan: Use devm_kcalloc() in acpi_fan_get_fps()
From: Markus Elfring <elfring@...rs.sourceforge.net>
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 <elfring@...rs.sourceforge.net>
---
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
Powered by blists - more mailing lists