Skip to contentSkip to conversation

ia64/kernel/iosapic: replace a printk + WARN_ON() to a WARN()

PATCH In review CGEL 2 participants 2 messages Aug 21, 2021

lore
Share & tools
lore

CGEL

author
#0 lore raw

PATCH 1/1 ia64/kernel/iosapic: replace a printk + WARN_ON() to a WARN()

From: jing yangyang <[email protected]>

Replace a printk+WARN_ON() by a WARN(); this increases the chance of the string making it into the bugreport

This issue was detected with the help of Coccinelle.

---
 arch/ia64/kernel/iosapic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/ia64/kernel/iosapic.c +2 -6
index 35adcf8..cb8ba1c 100644
@@ -794,17 +794,13 @@ static inline unsigned char choose_dmode(void)
 	 */
 	irq = gsi_to_irq(gsi);
 	if (irq < 0) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n",
-		       gsi);
-		WARN_ON(1);
+		WARN_ON(1, "iosapic_unregister_intr(%u) unbalanced\n", gsi);
 		return;
 	}
 
 	spin_lock_irqsave(&iosapic_lock, flags);
 	if ((rte = find_rte(irq, gsi)) == NULL) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n",
-		       gsi);
-		WARN_ON(1);
+		WARN_ON(1, "iosapic_unregister_intr(%u) unbalanced\n", gsi);
 		goto out;
 	}
 
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

beside the fact that your patch seems to change the log level from ERR to WARN, have you compile tested your change?

You are still using WARN_ON, which takes only 1 parameter.

CJ

Le 21/08/2021 à 05:44, CGEL a écrit :

Quoted 3 lines

From: jing yangyang <[email protected]>

Replace a printk+WARN_ON() by a WARN(); this increases the chance of

                                  ^^^^
Quoted 15 lines

the string making it into the bugreport

This issue was detected with the help of Coccinelle.

---
  arch/ia64/kernel/iosapic.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
arch/ia64/kernel/iosapic.c +0 -0
index 35adcf8..cb8ba1c 100644

arch/ia64/kernel/iosapic.c static inline unsigned char choose_dmode(void) · line 797

Quoted 7 lines
arch/ia64/kernel/iosapic.c +1 -3
@@ -794,17 +794,13 @@ static inline unsigned char choose_dmode(void)
  	 */
  	irq = gsi_to_irq(gsi);
  	if (irq < 0) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n",
-		       gsi);
-		WARN_ON(1);
+		WARN_ON(1, "iosapic_unregister_intr(%u) unbalanced\n", gsi);
                ^^^^^^^

arch/ia64/kernel/iosapic.c static inline unsigned char choose_dmode(void) · line 803

Quoted 9 lines
arch/ia64/kernel/iosapic.c +1 -3
  		return;
  	}
 
  	spin_lock_irqsave(&iosapic_lock, flags);
  	if ((rte = find_rte(irq, gsi)) == NULL) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n",
-		       gsi);
-		WARN_ON(1);
+		WARN_ON(1, "iosapic_unregister_intr(%u) unbalanced\n", gsi);
                ^^^^^^^
Quoted 4 lines
arch/ia64/kernel/iosapic.c +0 -0
  		goto out;
  	}