Skip to contentSkip to conversation

x86: mm: use WARN_ONCE instead of printk and WARN_ON_ONCE

PATCH In review Qing Wang 2 participants 2 messages Dec 7, 2021

Subsystems (2)
lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 x86: mm: use WARN_ONCE instead of printk and WARN_ON_ONCE

From: Wang Qing <[email protected]>

Simply use WARN_ONCE instead of printk(KERN_WARNING, ...) and WARN_ON_ONCE.

---
 arch/x86/mm/ioremap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/mm/ioremap.c +2 -3
index 026031b..af9a321
@@ -195,9 +195,8 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
 		return NULL;
 
 	if (!phys_addr_valid(phys_addr)) {
-		printk(KERN_WARNING "ioremap: invalid physical address %llx\n",
-		       (unsigned long long)phys_addr);
-		WARN_ON_ONCE(1);
+		WARN_ONCE(1, "ioremap: invalid physical address %llx\n",
+			 (unsigned long long)phys_addr);
 		return NULL;
 	}
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 16 lines · Qing Wang

From: Wang Qing <[email protected]>

Simply use WARN_ONCE instead of printk(KERN_WARNING, ...) and WARN_ON_ONCE.

---
 arch/x86/mm/ioremap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/mm/ioremap.c +0 -0
index 026031b..af9a321
@@ -195,9 +195,8 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
 		return NULL;

arch/x86/mm/ioremap.c __ioremap_caller(resource_size_t phys_addr, unsigned long size, · line 202

Quoted 10 lines
arch/x86/mm/ioremap.c +2 -3
 
 	if (!phys_addr_valid(phys_addr)) {
-		printk(KERN_WARNING "ioremap: invalid physical address %llx\n",
-		       (unsigned long long)phys_addr);
-		WARN_ON_ONCE(1);
+		WARN_ONCE(1, "ioremap: invalid physical address %llx\n",
+			 (unsigned long long)phys_addr);
 		return NULL;
 	}
 

This is not an equivalent transformation.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette