Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426216 > unrolled thread

[PATCH] ACPICA: Use acpi_os_allocate_zeroed

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-06-20 08:00 +0200
Last post2016-06-20 08:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] ACPICA: Use acpi_os_allocate_zeroed Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-06-20 08:00 +0200

#1426216 — [PATCH] ACPICA: Use acpi_os_allocate_zeroed

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-06-20 08:00 +0200
Subject[PATCH] ACPICA: Use acpi_os_allocate_zeroed
Message-ID<rM0pz-4g5-1@gated-at.bofh.it>
acpi_os_allocate_zeroed combines acpi_os_allocate and memset 0.

The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            acpi_os_allocate
+            acpi_os_allocate_zeroed
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/acpi/acpica/utcache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
index f8e9978..862f963 100644
--- a/drivers/acpi/acpica/utcache.c
+++ b/drivers/acpi/acpica/utcache.c
@@ -77,14 +77,13 @@ acpi_os_create_cache(char *cache_name,
 
 	/* Create the cache object */
 
-	cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
+	cache = acpi_os_allocate_zeroed(sizeof(struct acpi_memory_list));
 	if (!cache) {
 		return (AE_NO_MEMORY);
 	}
 
 	/* Populate the cache object and return it */
 
-	memset(cache, 0, sizeof(struct acpi_memory_list));
 	cache->list_name = cache_name;
 	cache->object_size = object_size;
 	cache->max_depth = max_depth;
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web