Skip to content

Commit ca4bc2e

Browse files
Waiman-Longingomolnar
authored andcommitted
locking/qspinlock: Fix 'wait_early' set but not used warning
When CONFIG_LOCK_EVENT_COUNTS is off, the wait_early variable will be set but not used. This is expected. Recent compilers will not generate wait_early code in this case. Add the __maybe_unused attribute to wait_early for suppressing this W=1 warning. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20240222150540.79981-2-longman@redhat.com Closes: https://lore.kernel.org/oe-kbuild-all/202312260422.f4pK3f9m-lkp@intel.com/
1 parent 6dfee11 commit ca4bc2e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/locking/qspinlock_paravirt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ static void pv_wait_node(struct mcs_spinlock *node, struct mcs_spinlock *prev)
294294
{
295295
struct pv_node *pn = (struct pv_node *)node;
296296
struct pv_node *pp = (struct pv_node *)prev;
297+
bool __maybe_unused wait_early;
297298
int loop;
298-
bool wait_early;
299299

300300
for (;;) {
301301
for (wait_early = false, loop = SPIN_THRESHOLD; loop; loop--) {

0 commit comments

Comments
 (0)