linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPICA: Use acpi_os_allocate_zeroed
@ 2016-06-20  5:52 Amitoj Kaur Chawla
  0 siblings, 0 replies; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-06-20  5:52 UTC (permalink / raw)
  To: robert.moore, lv.zheng, rafael.j.wysocki, lenb, linux-acpi,
	devel, linux-kernel
  Cc: julia.lawall

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ACPICA: Use acpi_os_allocate_zeroed
@ 2016-06-18  6:50 Amitoj Kaur Chawla
  0 siblings, 0 replies; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-06-18  6:50 UTC (permalink / raw)
  To: robert.moore, lv.zheng, rafael.j.wysocki, lenb, linux-acpi,
	devel, linux-kernel
  Cc: julia.lawall

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/uttrack.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 60c406a..5ad2641 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -95,13 +95,11 @@ acpi_ut_create_list(char *list_name,
 {
 	struct acpi_memory_list *cache;
 
-	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);
 	}
 
-	memset(cache, 0, sizeof(struct acpi_memory_list));
-
 	cache->list_name = list_name;
 	cache->object_size = object_size;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-20  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20  5:52 [PATCH] ACPICA: Use acpi_os_allocate_zeroed Amitoj Kaur Chawla
  -- strict thread matches above, loose matches on Subject: below --
2016-06-18  6:50 Amitoj Kaur Chawla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).