Skip to contentSkip to conversation

smp: Fix unused-but-set-variable warning

PATCH New Wei Yongjun 1 participant 1 message Jul 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smp: Fix unused-but-set-variable warning

Gcc report build warning as follows:

kernel/smp.c:126:15: warning:
variable 'csd_type' set but not used [-Wunused-but-set-variable]

  126 |  unsigned int csd_type;
      |               ^~~~~~~~

'csd_type' is only used when CONFIG_64BIT defined, so move them under '#ifdef'.

---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/smp.c +1 -1
index 6ec6c9578225..0130bdcf6d26 100644
@@ -123,10 +123,10 @@ static void csd_lock_record(call_single_data_t *csd)
 
 static __always_inline int csd_lock_wait_getcpu(call_single_data_t *csd)
 {
+#ifdef CONFIG_64BIT
 	unsigned int csd_type;
 
 	csd_type = CSD_TYPE(csd);
-#ifdef CONFIG_64BIT
 	if (csd_type == CSD_TYPE_ASYNC || csd_type == CSD_TYPE_SYNC)
 		return csd->dst; // Other CSD_TYPE_ values might not have ->dst.
 #endif