mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: barebox@lists.infradead.org
Subject: [PATCH] edb93xx: Avoid stack usage in early_udelay()
Date: Sun, 7 Feb 2010 00:55:22 +0100	[thread overview]
Message-ID: <20100206235522.GF15617@darwin> (raw)
In-Reply-To: <d5ecf68c69351ddcef35759f76e7e8ce3d7e0571.1265500315.git.matthias@kaehlcke.net>

edb93xx: The purpose of early_udelay() is to provide delay functionality in the
early board setup, when the stack isn't set up yet. With some compiler versions
the current implementation makes use of the stack and ends up crashing. Fix this
by removing an explicit division from early_udelay()

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
 board/edb93xx/early_udelay.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/board/edb93xx/early_udelay.h b/board/edb93xx/early_udelay.h
index 3b26b3f..185283d 100644
--- a/board/edb93xx/early_udelay.h
+++ b/board/edb93xx/early_udelay.h
@@ -26,7 +26,7 @@
 static inline void early_udelay(uint32_t usecs)
 {
 	/* loop takes 4 cycles at 5.0ns (fastest case, running at 200MHz) */
-	register uint32_t loops = (usecs * 1000) / 20;
+	register uint32_t loops = usecs * (1000 / 20);
 
 	__asm__ volatile ("1:\n"
 			"subs %0, %1, #1\n"
-- 
1.6.5


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

      parent reply	other threads:[~2010-02-06 23:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d5ecf68c69351ddcef35759f76e7e8ce3d7e0571.1265500315.git.matthias@kaehlcke.net>
2010-02-06 23:54 ` [PATCH] edb93xx: Enable UART1 Matthias Kaehlcke
2010-02-06 23:55 ` Matthias Kaehlcke [this message]

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=20100206235522.GF15617@darwin \
    --to=matthias@kaehlcke.net \
    --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