Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1625465
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/6] ACPI-nfit: Use devm_kcalloc() in nfit_mem_dcr_init() |
| Date | 2017-04-18 19:00 +0200 |
| Message-ID | <txEDV-8uq-25@gated-at.bofh.it> (permalink) |
| References | <txEue-8r4-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 17:30:15 +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@users.sourceforge.net>
---
drivers/acpi/nfit/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 462e77272272..1aa625dc424a 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -809,9 +809,11 @@ static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc,
continue;
nfit_mem->nfit_flush = nfit_flush;
flush = nfit_flush->flush;
- nfit_mem->flush_wpq = devm_kzalloc(acpi_desc->dev,
- flush->hint_count
- * sizeof(struct resource), GFP_KERNEL);
+ nfit_mem->flush_wpq
+ = devm_kcalloc(acpi_desc->dev,
+ flush->hint_count,
+ sizeof(*nfit_mem->flush_wpq),
+ GFP_KERNEL);
if (!nfit_mem->flush_wpq)
return -ENOMEM;
for (i = 0; i < flush->hint_count; i++) {
--
2.12.2
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/6] ACPI: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 18:50 +0200 [PATCH 6/6] ACPI-proc: Replace two seq_printf() calls by seq_puts() in acpi_system_wakeup_device_seq_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200 [PATCH 2/6] ACPI-fan: Delete error messages for a failed memory allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200 [PATCH 5/6] ACPI-battery: Replace 16 seq_printf() calls by seq_puts() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200 [PATCH 1/6] ACPI-fan: Use devm_kcalloc() in acpi_fan_get_fps() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200 [PATCH 4/6] ACPI-APEI-EINJ: Replace 12 seq_printf() calls by seq_puts() in available_error_type_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200 [PATCH 3/6] ACPI-nfit: Use devm_kcalloc() in nfit_mem_dcr_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 19:00 +0200
csiph-web