Skip to contentSkip to conversation

hrtimer: Fix 'set but not used' warning with lockdep_hrtimer_exit

PATCH New YiFei Zhu 1 participant 1 message Nov 14, 2022

lore
Share & tools
lore

YiFei Zhu

author
#0 lore raw

PATCH 1/1 hrtimer: Fix 'set but not used' warning with lockdep_hrtimer_exit

In a defconfig build with 'unused-but-set-variable' enabled, we get:

kernel/time/hrtimer.c: In function ‘__run_hrtimer’:
kernel/time/hrtimer.c:1648:14: error: variable ‘expires_in_hardirq’
set but not used [-Werror=unused-but-set-variable]

   1648 |         bool expires_in_hardirq;
        |              ^~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

Resolve this by evaluating expires_in_hardirq and casting it to void.

Fixes 40db173965c0 ("lockdep: Add hrtimer context tracing bits")
---
 include/linux/irqflags.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irqflags.h +1 -1
index 5ec0fa71399e..df74d0df8e1f 100644
@@ -125,7 +125,7 @@ do {						\
 # define lockdep_softirq_enter()		do { } while (0)
 # define lockdep_softirq_exit()			do { } while (0)
 # define lockdep_hrtimer_enter(__hrtimer)	false
-# define lockdep_hrtimer_exit(__context)	do { } while (0)
+# define lockdep_hrtimer_exit(__context)	((void)(__context))
 # define lockdep_posixtimer_enter()		do { } while (0)
 # define lockdep_posixtimer_exit()		do { } while (0)
 # define lockdep_irq_work_enter(__work)		do { } while (0)
Signature · 1 line
2.38.1.493.g58b659f92b-goog