mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM/i.MX53: fix compiler warning
Date: Mon, 26 Feb 2018 09:38:47 +0100	[thread overview]
Message-ID: <20180226083847.30625-1-s.hauer@pengutronix.de> (raw)

The code wants to test if the lower 16bits of the content of
MX53_CSD0_BASE_ADDR and SDRAM_COMPARE_CONST1 are identical. The assembly
this code was derived from did:

	mov             r5, r0, lsl #16
        mov             r6, r7, lsl #16
        cmp             r5, r6

In C this is better written with masks which is better readable and
avoid this compiler warning:

arch/arm/mach-imx/esdctl-v4.c:613:63: warning: result of '305419896 << 16' requires 46 bits to represent, but 'int' only has 32 bits [-Wshift-overflow=]

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/esdctl-v4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/esdctl-v4.c b/arch/arm/mach-imx/esdctl-v4.c
index 6de4a8d6e7..b32f56d622 100644
--- a/arch/arm/mach-imx/esdctl-v4.c
+++ b/arch/arm/mach-imx/esdctl-v4.c
@@ -610,7 +610,7 @@ void imx_esdctlv4_init(void)
 	 * ok, last possibility is 16b bus on low data-lines, check that
 	 * (i.MX25 also suports 16b on high data-lines, but i.MX53 doesn't)
 	 */
-	if (readl(MX53_CSD0_BASE_ADDR) << 16 == SDRAM_COMPARE_CONST1 << 16) {
+	if ((readl(MX53_CSD0_BASE_ADDR) & 0xffff) == (SDRAM_COMPARE_CONST1 & 0xffff)) {
 		esdctl0 |= ESDCTL_V4_ESDCTLx_DSIZ_16B_LOW;
 		mask >>= 16;
 		goto sdram_bussize_found;
-- 
2.16.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-02-26  8:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180226083847.30625-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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