]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
staging: fsl-mc/dpio: Fix cast truncate warning
authorIoana Radulescu <ruxandra.radulescu@nxp.com>
Tue, 6 Mar 2018 17:43:45 +0000 (11:43 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Mar 2018 17:57:37 +0000 (09:57 -0800)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-mc/include/dpaa2-fd.h

index 70501d7789c0390702c0d1570b73db56ee7f0dda..b55b89ba4eda6e3f29bf39f40b66251871fe7560 100644 (file)
@@ -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);
 }