public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexandru Gagniuc <alex.g@adaptrum.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] common/xyzModem.c: Do not use hard-coded address for debug buffer
Date: Tue,  4 Apr 2017 10:42:31 -0700	[thread overview]
Message-ID: <20170404174231.367-2-alex.g@adaptrum.com> (raw)
In-Reply-To: <20170404174231.367-1-alex.g@adaptrum.com>

Under the plethora of #ifdefs, the xyzModem code hid this pearl:
static char *zm_out = (char *) 0x00380000;
This was only enabled when DEBUG is defined, so it's probably why it
went unnoticed for so long. No idea what platform had memory at that
exact location, but the this approach is extremely hacky.
Use a static buffer instead.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
---
 common/xyzModem.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/common/xyzModem.c b/common/xyzModem.c
index 6ded958..a0c5dfe 100644
--- a/common/xyzModem.c
+++ b/common/xyzModem.c
@@ -176,16 +176,10 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
 /*
  * Note: this debug setup works by storing the strings in a fixed buffer
  */
-#define FINAL
-#ifdef FINAL
-static char *zm_out = (char *) 0x00380000;
-static char *zm_out_start = (char *) 0x00380000;
-#else
-static char zm_buf[8192];
-static char *zm_out = zm_buf;
-static char *zm_out_start = zm_buf;
+static char zm_debug_buf[8192];
+static char *zm_out = zm_debug_buf;
+static char *zm_out_start = zm_debug_buf;
 
-#endif
 static int
 zm_dprintf (char *fmt, ...)
 {
-- 
2.9.3

  reply	other threads:[~2017-04-04 17:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 17:42 [U-Boot] [PATCH 1/2] common/xyzModem.c: unifdef (Remove useless #ifdefs) Alexandru Gagniuc
2017-04-04 17:42 ` Alexandru Gagniuc [this message]
2017-04-09  1:15   ` [U-Boot] [U-Boot, 2/2] common/xyzModem.c: Do not use hard-coded address for debug buffer Tom Rini
2017-04-09  1:15 ` [U-Boot] [U-Boot, 1/2] common/xyzModem.c: unifdef (Remove useless #ifdefs) Tom Rini

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=20170404174231.367-2-alex.g@adaptrum.com \
    --to=alex.g@adaptrum.com \
    --cc=u-boot@lists.denx.de \
    /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