Skip to contentSkip to conversation

Subject: [RFC][PATCH 05/11] stmmac: fix several stray endianness bugs

PATCH Al Viro 2 participants 2 messages Jan 5, 2018 – Jan 8, 2018

Subsystems (4)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

A few places got missed by "net: ethernet: stmmac: change dma descriptors to __le32" (having been introduced just before the merge of that patch, AFAICS). Fix them up...

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +5 -4
index 2fd8456999f6..b419229d7457 100644
@@ -241,12 +241,13 @@ static int dwmac4_rx_check_timestamp(void *desc)
 	u32 own, ctxt;
 	int ret = 1;
 
-	own = p->des3 & RDES3_OWN;
-	ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR)
+	own = le32_to_cpu(p->des3) & RDES3_OWN;
+	ctxt = ((le32_to_cpu(p->des3) & RDES3_CONTEXT_DESCRIPTOR)
 		>> RDES3_CONTEXT_DESCRIPTOR_SHIFT);
 
 	if (likely(!own && ctxt)) {
-		if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
+		if ((p->des0 == cpu_to_le32(0xffffffff)) &&
+		    (p->des1 == cpu_to_le32(0xffffffff)))
 			/* Corrupted value */
 			ret = -EINVAL;
 		else
@@ -265,7 +266,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
 	int ret = -EINVAL;
 
 	/* Get the status from normal w/b descriptor */
-	if (likely(p->des3 & TDES3_RS1V)) {
+	if (likely(p->des3 & cpu_to_le32(TDES3_RS1V))) {
 		if (likely(le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE)) {
 			int i = 0;
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 4 lines · Al Viro

A few places got missed by "net: ethernet: stmmac: change dma descriptors to __le32" (having been introduced just before the merge of that patch, AFAICS). Fix them up...

I could not spot the commit id associated with that change, which one is it?

Signature · 1 line
Florian