Skip to contentSkip to conversation

kernel/watchdog: change prototype of watchdog_nmi_enable()

PATCH In review Pingfan Liu 2 participants 3 messages Aug 24, 2021 – Sep 2, 2021 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/watchdog: change prototype of watchdog_nmi_enable()

The only caller does not handle the return value of watchdog_nmi_enable(). If there is an error, it seems to be reported by arch specific code.

Hence changing watchdog_nmi_enable() return value from int to void.

Cc "David S. Miller" <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Wang Qing <[email protected]>
Cc Santosh Sivaraj <[email protected]>
Cc Tejun Heo <[email protected]>

To: [email protected]
To: [email protected]

---
 arch/sparc/kernel/nmi.c | 8 +++-----
 include/linux/nmi.h     | 2 +-
 kernel/watchdog.c       | 3 +--
 3 files changed, 5 insertions(+), 8 deletions(-)
arch/sparc/kernel/nmi.c +3 -5
index 060fff95a305..5dcf31f7e81f 100644
@@ -282,11 +282,11 @@ __setup("nmi_watchdog=", setup_nmi_watchdog);
  * sparc specific NMI watchdog enable function.
  * Enables watchdog if it is not enabled already.
  */
-int watchdog_nmi_enable(unsigned int cpu)
+void watchdog_nmi_enable(unsigned int cpu)
 {
 	if (atomic_read(&nmi_active) == -1) {
 		pr_warn("NMI watchdog cannot be enabled or disabled\n");
-		return -1;
+		return;
 	}
 
 	/*
@@ -295,11 +295,9 @@ int watchdog_nmi_enable(unsigned int cpu)
 	 * process first.
 	 */
 	if (!nmi_init_done)
-		return 0;
+		return;
 
 	smp_call_function_single(cpu, start_nmi_watchdog, NULL, 1);
-
-	return 0;
 }
 /*
  * sparc specific NMI watchdog disable function.
include/linux/nmi.h +1 -1
index 750c7f395ca9..b7bcd63c36b4 100644
@@ -119,7 +119,7 @@ static inline int hardlockup_detector_perf_init(void) { return 0; }
 void watchdog_nmi_stop(void);
 void watchdog_nmi_start(void);
 int watchdog_nmi_probe(void);
-int watchdog_nmi_enable(unsigned int cpu);
+void watchdog_nmi_enable(unsigned int cpu);
 void watchdog_nmi_disable(unsigned int cpu);
 
 /**
kernel/watchdog.c +1 -2
index ad912511a0c0..ea31fcf3b83b 100644
@@ -95,10 +95,9 @@ __setup("nmi_watchdog=", hardlockup_panic_setup);
  * softlockup watchdog start and stop. The arch must select the
  * SOFTLOCKUP_DETECTOR Kconfig.
  */
-int __weak watchdog_nmi_enable(unsigned int cpu)
+void __weak watchdog_nmi_enable(unsigned int cpu)
 {
 	hardlockup_detector_perf_enable();
-	return 0;
 }
 
 void __weak watchdog_nmi_disable(unsigned int cpu)
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Pingfan Liu

The only caller does not handle the return value of watchdog_nmi_enable(). If there is an error, it seems to be reported by arch specific code.

Hence changing watchdog_nmi_enable() return value from int to void.

Looks good to me:

Best Regards,
Petr

#2 lore raw

Hi Petr,

Thank you for reviewing.

But I am composing a series, which may overstep this patch. So please drop this patch, and sorry for inconvenience.

Regards,

Pingfan

Quoted 16 lines · Petr Mladek
Quoted 7 lines · Pingfan Liu

The only caller does not handle the return value of watchdog_nmi_enable(). If there is an error, it seems to be reported by arch specific code.

Hence changing watchdog_nmi_enable() return value from int to void.

Looks good to me:

Best Regards,
Petr