Skip to contentSkip to conversation

sparc: Use swap() to fix Coccinelle warning

PATCH In review Thorsten Blum 2 participants 2 messages Apr 4, 2024 – Apr 22, 2024 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: Use swap() to fix Coccinelle warning

Fixes the following Coccinelle/coccicheck warning reported by swap.cocci:

WARNING opportunity for swap()

---
 arch/sparc/include/asm/floppy_64.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/sparc/include/asm/floppy_64.h +1 -3
index 6efeb24b0a92..83decacd0a2d 100644
@@ -704,9 +704,7 @@ static unsigned long __init sun_floppy_init(void)
 			ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
 			ns87303_modify(config, FCR, 0, FCR_LDE);
 
-			config = sun_floppy_types[0];
-			sun_floppy_types[0] = sun_floppy_types[1];
-			sun_floppy_types[1] = config;
+			swap(sun_floppy_types[0], sun_floppy_types[1]);
 
 			if (sun_pci_broken_drive != -1) {
 				sun_pci_broken_drive = 1 - sun_pci_broken_drive;
Signature · 1 line
2.44.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Thorsten Blum

Fixes the following Coccinelle/coccicheck warning reported by swap.cocci:

WARNING opportunity for swap()

---
 arch/sparc/include/asm/floppy_64.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/sparc/include/asm/floppy_64.h +0 -0
index 6efeb24b0a92..83decacd0a2d 100644

arch/sparc/include/asm/floppy_64.h static unsigned long __init sun_floppy_init(void) · line 710

Quoted 10 lines
arch/sparc/include/asm/floppy_64.h +1 -3
@@ -704,9 +704,7 @@ static unsigned long __init sun_floppy_init(void)
 			ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
 			ns87303_modify(config, FCR, 0, FCR_LDE);
 
-			config = sun_floppy_types[0];
-			sun_floppy_types[0] = sun_floppy_types[1];
-			sun_floppy_types[1] = config;
+			swap(sun_floppy_types[0], sun_floppy_types[1]);
 
 			if (sun_pci_broken_drive != -1) {
 				sun_pci_broken_drive = 1 - sun_pci_broken_drive;

Picking this up to my for-next

Thanks,
Andreas