Skip to contentSkip to conversation

NTB: fix 32-bit compiler warning

PATCH In review Arnd Bergmann 2 participants 2 messages Oct 7, 2015 – Nov 8, 2015 NTB driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NTB: fix 32-bit compiler warning

resource_size_t may be 32-bit wide on some architectures, which causes this warning when building the NTB code:

drivers/ntb/ntb_transport.c: In function 'ntb_transport_link_work':
drivers/ntb/ntb_transport.c:828:46: warning: right shift count >= width of type [-Wshift-count-overflow]

The warning is harmless but can be avoided by using the upper_32_bits() macro.

Fixes e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")

---
Found while building ARM allmodconfig

drivers/ntb/ntb_transport.c +2 -2
index 6e3ee907d186..700f3ae833c2 100644
@@ -825,10 +825,10 @@ static void ntb_transport_link_work(struct work_struct *work)
 			size = max_mw_size;
 
 		spad = MW0_SZ_HIGH + (i * 2);
-		ntb_peer_spad_write(ndev, spad, (u32)(size >> 32));
+		ntb_peer_spad_write(ndev, spad, upper_32_bits(size));
 
 		spad = MW0_SZ_LOW + (i * 2);
-		ntb_peer_spad_write(ndev, spad, (u32)size);
+		ntb_peer_spad_write(ndev, spad, lower_32_bits(size));
 	}
 
 	ntb_peer_spad_write(ndev, NUM_MWS, nt->mw_count);
maintainer
#1 lore raw
Quoted 11 lines · Arnd Bergmann

resource_size_t may be 32-bit wide on some architectures, which causes this warning when building the NTB code:

drivers/ntb/ntb_transport.c: In function 'ntb_transport_link_work':
drivers/ntb/ntb_transport.c:828:46: warning: right shift count >= width of type [-Wshift-count-overflow]

The warning is harmless but can be avoided by using the upper_32_bits() macro.

Fixes e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")

Pulled in to the next release (coming out shortly).

Thanks,
Jon

Quoted 27 lines

---
Found while building ARM allmodconfig

drivers/ntb/ntb_transport.c +2 -2
index 6e3ee907d186..700f3ae833c2 100644
@@ -825,10 +825,10 @@ static void ntb_transport_link_work(struct work_struct *work)
 			size = max_mw_size;
 
 		spad = MW0_SZ_HIGH + (i * 2);
-		ntb_peer_spad_write(ndev, spad, (u32)(size >> 32));
+		ntb_peer_spad_write(ndev, spad, upper_32_bits(size));
 
 		spad = MW0_SZ_LOW + (i * 2);
-		ntb_peer_spad_write(ndev, spad, (u32)size);
+		ntb_peer_spad_write(ndev, spad, lower_32_bits(size));
 	}
 
 	ntb_peer_spad_write(ndev, NUM_MWS, nt->mw_count);
Signature · 6 lines
-- 
You received this message because you are subscribed to the Google Groups "linux-ntb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-ntb+unsubscribe at googlegroups.com.
To post to this group, send email to linux-ntb at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/linux-ntb/10263287.Brd9HPYQJD%40wuerfel.
For more options, visit https://groups.google.com/d/optout.