From: Mike Frysinger Date: Wed, 22 Jun 2011 12:57:55 -0400 Subject: [U-Boot] [PATCH V2 2/2] MMC: add erase function to both mmc and sd In-Reply-To: <1308579016-22376-3-git-send-email-leiwen@marvell.com> References: <1308232076-20116-1-git-send-email-leiwen@marvell.com> <1308579016-22376-3-git-send-email-leiwen@marvell.com> Message-ID: <201106221257.56864.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 Monday, June 20, 2011 10:10:16 Lei Wen wrote: > + if (state == MMC_ERASE) { > + blk = simple_strtoul(argv[2], NULL, 16); > + cnt = simple_strtoul(argv[3], NULL, 16); > + } else { > + addr = (void *)simple_strtoul(argv[2], NULL, 16); > + blk = simple_strtoul(argv[3], NULL, 16); > + cnt = simple_strtoul(argv[4], NULL, 16); > + } you could do: char **args = &argv[2]; if (state != MMC_ERASE) { addr = (void *)simple_strtoul(args[0], NULL, 16); ++args; } else addr = 0; blk = simple_strtoul(args[0], NULL, 16); simple_strtoul(args[1], NULL, 16); > + "mmc erase addr blk# cnt\n" i dont think the "erase" cmd takes an addr > +err_out: > + printf("mmc erase failed\n\r"); dont use \r in strings, and use puts() -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 : http://lists.denx.de/pipermail/u-boot/attachments/20110622/fc2895f6/attachment.pgp