[3/8] mem_region.c: Move ifdef for MEM_POISON to shut up static analysis

Message ID 20181129042833.27376-4-stewart@linux.ibm.com
State Accepted
Headers show
Series
  • Random static analysis fixes
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Stewart Smith Nov. 29, 2018, 4:28 a.m.
The static analysis tool is arguably wrong and should go away.

But... I'm sick of keeping coming back to it and reviewing the false
positives enough to make a slight change to where ifdefs are.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
---
 core/mem_region.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/core/mem_region.c b/core/mem_region.c
index 7aac4e1c4f6a..74551922b1be 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -162,8 +162,6 @@  static void mem_poison(struct free_hdr *f)
 
 	memset(f+1, POISON_MEM_REGION_WITH, poison_size);
 }
-#else
-static inline void mem_poison(struct free_hdr *f __unused) { }
 #endif
 
 /* Creates free block covering entire region. */
@@ -178,7 +176,9 @@  static void init_allocatable_region(struct mem_region *region)
 	*tailer(f) = f->hdr.num_longs;
 	list_head_init(&region->free_list);
 	list_add(&region->free_list, &f->list);
+#if POISON_MEM_REGION == 1
 	mem_poison(f);
+#endif
 }
 
 static void make_free(struct mem_region *region, struct free_hdr *f,
@@ -186,8 +186,12 @@  static void make_free(struct mem_region *region, struct free_hdr *f,
 {
 	struct alloc_hdr *next;
 
+#if POISON_MEM_REGION == 1
 	if (!skip_poison)
 		mem_poison(f);
+#else
+	(void)skip_poison;
+#endif
 
 	if (f->hdr.prev_free) {
 		struct free_hdr *prev;