linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/kmemleak: fix errors/warnings for coding style
@ 2024-10-18  9:22 Pintu Kumar
  0 siblings, 0 replies; only message in thread
From: Pintu Kumar @ 2024-10-18  9:22 UTC (permalink / raw)
  To: akpm, catalin.marinas, linux-mm, linux-kernel
  Cc: skhan, pintu.ping, Pintu Kumar

There are several errors/warnings reported by checkpatch.
Fix all of the positive once as below:
- Use #include <linux/processor.h> instead of <asm/processor.h>
- Missing a blank lines after declarations
- Prefer 'unsigned int' to bare use of 'unsigned'
- else should follow close brace '}'

Signed-off-by: Pintu Kumar <quic_pintu@quicinc.com>

---
Changes in V2:
Introduce missing bracket in else as suggested by Catalin Marinas.
V1: https://lore.kernel.org/all/ZxDbgS98-_VNkGXJ@arm.com/
---
 mm/kmemleak.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 17006d8a2afa..312a1a9fba97 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * mm/kmemleak.c
- *
  * Copyright (C) 2008 ARM Limited
  * Written by Catalin Marinas <catalin.marinas@arm.com>
  *
@@ -95,7 +93,7 @@
 #include <linux/crc32.h>
 
 #include <asm/sections.h>
-#include <asm/processor.h>
+#include <linux/processor.h>
 #include <linux/atomic.h>
 
 #include <linux/kasan.h>
@@ -373,6 +371,7 @@ static void print_unreferenced(struct seq_file *seq,
 
 	for (i = 0; i < nr_entries; i++) {
 		void *ptr = (void *)entries[i];
+
 		warn_or_seq_printf(seq, "    [<%pK>] %pS\n", ptr, ptr);
 	}
 }
@@ -1711,6 +1710,7 @@ static void kmemleak_scan(void)
 		rcu_read_lock();
 		for_each_process_thread(g, p) {
 			void *stack = try_get_task_stack(p);
+
 			if (stack) {
 				scan_block(stack, stack + THREAD_SIZE, NULL);
 				put_task_stack(p);
@@ -1817,6 +1817,7 @@ static int kmemleak_scan_thread(void *arg)
 	 */
 	if (first_run) {
 		signed long timeout = msecs_to_jiffies(SECS_FIRST_SCAN * 1000);
+
 		first_run = 0;
 		while (timeout && !kthread_should_stop())
 			timeout = schedule_timeout_interruptible(timeout);
@@ -2062,7 +2063,7 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf,
 	else if (strncmp(buf, "scan=off", 8) == 0)
 		stop_scan_thread();
 	else if (strncmp(buf, "scan=", 5) == 0) {
-		unsigned secs;
+		unsigned int secs;
 		unsigned long msecs;
 
 		ret = kstrtouint(buf + 5, 0, &secs);
@@ -2179,9 +2180,10 @@ static int __init kmemleak_boot_config(char *str)
 	else if (strcmp(str, "on") == 0) {
 		kmemleak_skip_disable = 1;
 		stack_depot_request_early_init();
-	}
-	else
+	} else {
 		return -EINVAL;
+	}
+
 	return 0;
 }
 early_param("kmemleak", kmemleak_boot_config);
-- 
2.17.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-18  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-18  9:22 [PATCH v2] mm/kmemleak: fix errors/warnings for coding style Pintu Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox