netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: netdev@vger.kernel.org
Cc: <peppe.cavallaro@st.com>,
	Cavallaro@ftp.linux.org.uk, Giuseppe@ftp.linux.org.uk
Subject: Subject: [RFC][PATCH 05/11] stmmac: fix several stray endianness bugs
Date: Fri, 05 Jan 2018 19:32:08 +0000	[thread overview]
Message-ID: <E1eXXiq-0002C4-Ii@ZenIV.linux.org.uk> (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...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index 2fd8456999f6..b419229d7457 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -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;
 
-- 
2.11.0

             reply	other threads:[~2018-01-05 19:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-05 19:32 Al Viro [this message]
2018-01-08  1:34 ` Subject: [RFC][PATCH 05/11] stmmac: fix several stray endianness bugs Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1eXXiq-0002C4-Ii@ZenIV.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=Cavallaro@ftp.linux.org.uk \
    --cc=Giuseppe@ftp.linux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).