From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 26 Jan 2012 21:52:05 -0500 Subject: [U-Boot] [PATCH V3 4/6] sf command: allow default chip select through CONFIG_SPI_FLASH_CS In-Reply-To: <4F21FF96.60907@boundarydevices.com> References: <1327421904-21487-1-git-send-email-eric.nelson@boundarydevices.com> <4F201B5A.4010500@esd.eu> <4F21FF96.60907@boundarydevices.com> Message-ID: <201201262152.07464.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 26 January 2012 20:36:22 Eric Nelson wrote: > On 01/25/2012 08:10 AM, Matthias Fuchs wrote: > > On 24.01.2012 17:18, Eric Nelson wrote: > >> --- a/common/cmd_sf.c > >> +++ b/common/cmd_sf.c > >> > >> char *endp; > >> struct spi_flash *new; > >> > >> - if (argc< 2) > >> - return -1; > >> - > >> - cs = simple_strtoul(argv[1],&endp, 0); > >> - if (*argv[1] == 0 || (*endp != 0&& *endp != ':')) > >> +#ifndef CONFIG_SPI_FLASH_CS > >> + if (argc< 2) { > >> + printf("%s: missing arguments\n", __func__); > > > > I think this format for the error message is a little bit untypical for > > u-boot. We do not show up the internal C function name. Better would be > > to show the command usage, right? > > Looking at this area of the code in more detail, there are quite > a few cases where improper usage silently return -1. > > I'm inclined to either follow that lead or toss them together > with a "goto usage" as done in do_spi_flash(). > > Any preferences? invalid syntax should return cmd_usage(). errors should return non-zero, not usage information. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: