From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Dunn Date: Thu, 18 Apr 2013 08:47:19 -0700 Subject: [U-Boot] [PATCH v4] palmtreo680: add utility that writes u-boot to flash In-Reply-To: <201304181554.15041.marex@denx.de> References: <1366143307-7055-1-git-send-email-mikedunn@newsguy.com> <201304181554.15041.marex@denx.de> Message-ID: <51701587.9060309@newsguy.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04/18/2013 06:54 AM, Marek Vasut wrote: > Dear Mike Dunn, > > [...] > >> + if (argc != 3) { >> + printf("usage: %s \n", argv[0]); > > btw is this /dev/mtdX or /dev/mtdblockX ? /dev/mtdx You must have defined a partition that starts at the offset at which you are placing the u-boot image, and of course is big enough to hold the image. > >> + return -1; > > errno.h didn't work? Like ... return -EINVAL or such ? 'return -EINVAL' works, sure. Are you suggesting that the utility should return an intelligent error code at all failure exit points? Like if the call to calloc() fails, it should return -ENOMEM? I could do that if you prefer. I didn't worry about it because I always print the reason for the failure to stderr, usually by way of perror(). Sorry, I guess I didn't understand your initial suggestion. > > [...] > >> + blockbuf = calloc(RELIABLE_BLOCKSIZE, 1); > > calloc() semantics are misunderstood by so many :-( calloc(RELIABLE_BLOCKSIZE, sizeof(char)) ? Thanks, Mike