Skip to contentSkip to conversation

nvmet: remove redundant assignment after left shift

PATCH Applied Colin Ian King 5 participants 5 messages Mar 18, 2022 – Mar 23, 2022

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

PATCH 1/1 nvmet: remove redundant assignment after left shift

The left shift is followed by a re-assignment back to cc_css, the assignment is redundant. Fix this by replacing the <<= operator with << instead.

Cleans up clang scan build warning:
drivers/nvme/target/core.c:1124:10: warning: Although the value stored to 'cc_css' is used in the enclosing expression, the value is never actually read from 'cc_css' [deadcode.DeadStores]

---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
index 724a6d373340..75876f70a7eb 100644
@@ -1121,7 +1121,7 @@ static inline u8 nvmet_cc_iocqes(u32 cc)
 
 static inline bool nvmet_css_supported(u8 cc_css)
 {
-	switch (cc_css <<= NVME_CC_CSS_SHIFT) {
+	switch (cc_css << NVME_CC_CSS_SHIFT) {
 	case NVME_CC_CSS_NVM:
 	case NVME_CC_CSS_CSI:
 		return true;
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Colin Ian King

The left shift is followed by a re-assignment back to cc_css, the assignment is redundant. Fix this by replacing the <<= operator with << instead.

Cleans up clang scan build warning:
drivers/nvme/target/core.c:1124:10: warning: Although the value stored to 'cc_css' is used in the enclosing expression, the value is never actually read from 'cc_css' [deadcode.DeadStores]

Looks good.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Colin Ian King
Quoted 11 lines · Colin Ian King

The left shift is followed by a re-assignment back to cc_css, the assignment is redundant. Fix this by replacing the <<= operator with << instead.

Cleans up clang scan build warning:
drivers/nvme/target/core.c:1124:10: warning: Although the value stored to 'cc_css' is used in the enclosing expression, the value is never actually read from 'cc_css' [deadcode.DeadStores]

Thanks, looks good.

-ck