Skip to contentSkip to conversation

watchdog: hpwdt: fix unused variable warning

PATCH In review Arnd Bergmann 3 participants 3 messages Dec 6, 2017 – Dec 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: hpwdt: fix unused variable warning

The new hpwdt_my_nmi() function is used conditionally, which produces a harmless warning in some configurations:

drivers/watchdog/hpwdt.c:478:12: error: 'hpwdt_my_nmi' defined but not used [-Werror=unused-function]

This moves it inside of the #ifdef that protects its caller, to silence the warning.

Fixes 621174a92851 ("watchdog: hpwdt: Check source of NMI")
---
 drivers/watchdog/hpwdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
index e61658310381..f1f00dfc0e68 100644
@@ -475,12 +475,12 @@ static int hpwdt_time_left(void)
 	return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
 }
 
+#ifdef CONFIG_HPWDT_NMI_DECODING
 static int hpwdt_my_nmi(void)
 {
 	return ioread8(hpwdt_nmistat) & 0x6;
 }
 
-#ifdef CONFIG_HPWDT_NMI_DECODING
 /*
  *	NMI Handler
  */
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 35 lines · Arnd Bergmann

The new hpwdt_my_nmi() function is used conditionally, which produces a harmless warning in some configurations:

drivers/watchdog/hpwdt.c:478:12: error: 'hpwdt_my_nmi' defined but not used [-Werror=unused-function]

This moves it inside of the #ifdef that protects its caller, to silence the warning.

Fixes 621174a92851 ("watchdog: hpwdt: Check source of NMI")
---
 drivers/watchdog/hpwdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
index e61658310381..f1f00dfc0e68 100644
@@ -475,12 +475,12 @@ static int hpwdt_time_left(void)
 	return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
 }
 
+#ifdef CONFIG_HPWDT_NMI_DECODING
 static int hpwdt_my_nmi(void)
 {
 	return ioread8(hpwdt_nmistat) & 0x6;
 }
 
-#ifdef CONFIG_HPWDT_NMI_DECODING
 /*
  *	NMI Handler
  */
Signature · 1 line
2.9.0

Looks fine. Thanks!

Signature · 3 lines
-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

The new hpwdt_my_nmi() function is used conditionally, which produces a harmless warning in some configurations:

drivers/watchdog/hpwdt.c:478:12: error: 'hpwdt_my_nmi' defined but not used [-Werror=unused-function]

This moves it inside of the #ifdef that protects its caller, to silence the warning.

Fixes 621174a92851 ("watchdog: hpwdt: Check source of NMI")
Quoted 23 lines
---
  drivers/watchdog/hpwdt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
index e61658310381..f1f00dfc0e68 100644
@@ -475,12 +475,12 @@ static int hpwdt_time_left(void)
  	return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
  }
 
+#ifdef CONFIG_HPWDT_NMI_DECODING
  static int hpwdt_my_nmi(void)
  {
  	return ioread8(hpwdt_nmistat) & 0x6;
  }
 
-#ifdef CONFIG_HPWDT_NMI_DECODING
  /*
   *	NMI Handler
   */