All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	roy.pledge@nxp.com, laurentiu.tudor@nxp.com
Subject: [PATCH 2/5] staging: fsl-mc/dpio: Fix cast truncate warning
Date: Tue,  6 Mar 2018 11:43:45 -0600	[thread overview]
Message-ID: <20180306174348.26095-3-ruxandra.radulescu@nxp.com> (raw)
In-Reply-To: <20180306174348.26095-1-ruxandra.radulescu@nxp.com>

Sparse reports the following warning:
drivers/staging/fsl-mc/include/dpaa2-fd.h:421:30:
warning: cast truncates bits from constant value (ffff7fff becomes 7fff)

Fix this by explicitly masking the value with 0xffff.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
 drivers/staging/fsl-mc/include/dpaa2-fd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h b/drivers/staging/fsl-mc/include/dpaa2-fd.h
index 70501d7..b55b89b 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-fd.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -418,8 +418,8 @@ static inline bool dpaa2_sg_is_final(const struct dpaa2_sg_entry *sg)
  */
 static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final)
 {
-	sg->format_offset &= cpu_to_le16(~(SG_FINAL_FLAG_MASK
-					 << SG_FINAL_FLAG_SHIFT));
+	sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK
+					 << SG_FINAL_FLAG_SHIFT)) & 0xFFFF);
 	sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT);
 }
 
-- 
2.7.4

  parent reply	other threads:[~2018-03-06 17:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 17:43 [PATCH 0/5] staging: fsl-mc/dpio: Fix sparse warnings Ioana Radulescu
2018-03-06 17:43 ` [PATCH 1/5] staging: fsl-mc/dpio: Fix incorrect cast Ioana Radulescu
2018-03-06 17:43 ` Ioana Radulescu [this message]
2018-03-06 17:43 ` [PATCH 3/5] staging: fsl-mc/dpio: Use __leXX types where needed Ioana Radulescu
2018-03-06 17:43 ` [PATCH 4/5] staging: fsl-mc/dpio: Fix incorrect masking Ioana Radulescu
2018-03-06 17:43 ` [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code Ioana Radulescu
2018-03-06 18:32   ` Ruxandra Ioana Ciocoi Radulescu
2018-03-08 17:58     ` gregkh

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=20180306174348.26095-3-ruxandra.radulescu@nxp.com \
    --to=ruxandra.radulescu@nxp.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roy.pledge@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.