mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Peter Mamonov <pmamonov@gmail.com>
Cc: barebox@lists.infradead.org, rhi@pengutronix.de
Subject: Re: [PATCH v2] commands: import memtester 4.3.0 from Debian GNU/Linux
Date: Fri, 30 Oct 2020 10:34:06 +0100	[thread overview]
Message-ID: <20201030093406.GK26805@pengutronix.de> (raw)
In-Reply-To: <20201029201357.GA7832@chr>

On Thu, Oct 29, 2020 at 11:13:58PM +0300, Peter Mamonov wrote:
> Hi, Sascha,
> 
> On Wed, Oct 28, 2020 at 10:47:37AM +0100, Sascha Hauer wrote:
> > Hi Peter,
> > 
> > There are a few more things to fix. I just saw I never answered to your
> > last mail.
> 
> > [...]
> 
> > > +    errno = 0;
> > > +    wantbytes = (size_t) strtoull_suffix(argv[optind], 0, 0);
> > > +    if (errno != 0) {
> > > +        printf("failed to parse memory argument");
> > > +        return COMMAND_ERROR_USAGE;
> > > +    }
> > 
> > strtoull_suffix() doesn't set errno. There is currently no way to detect
> > an error from strtoull_suffix().
> 
> errno is checked throughout the original code, including this slightly modified 
> piece. Should I remove those checks or keep them for the sake of future errno 
> support?

I'd say it's not worth it to keep compatibility to the original code in
this file. There are many small things that could/should be done
differently, so just drop errno from the code, use kstrtoul where
appropriate (unlike simple_strtoul kstrto* return an error).

> 
> > [...]
> 
> > > +        printf("  %-20s: ", "Stuck Address");
> > > +        console_flush();
> > 
> > Why did you add all these console_flush() throughout the code?
> 
> 
> I've merely replaced `fflush(stdout)` with `console_flush()` (see the original: 
> https://github.com/pmamonov/barebox/blob/31fd9d18f37ed58e5e559fe2ad6686066966f86e/commands/memtester/memtester.c#L374).  
> I choosed to keep all those (excessive) flushes as is, since most of the output 
> is a progress indicator which should be displayed immediately and I wasn't sure 
> that some type of barebox console won't cache the output.

barebox doesn't cache anything in the console layer. Only the UART
drivers do in their FIFOs, so console_flush() merely waits until the
hardware FIFOs are drained. Normally there is no reason to use
console_flush(), it's mainly useful to call it right before resetting
the board, before booting Linux, or before switching the baudrate.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      reply	other threads:[~2020-10-30  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 21:45 Peter Mamonov
2020-10-28  9:47 ` Sascha Hauer
2020-10-29 20:13   ` Peter Mamonov
2020-10-30  9:34     ` Sascha Hauer [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=20201030093406.GK26805@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=pmamonov@gmail.com \
    --cc=rhi@pengutronix.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