From: Wolfgang Denk Date: Tue, 07 Sep 2010 15:53:02 +0200 Subject: [U-Boot] [PATCH 3/3] MMC: print out avaible partition table In-Reply-To: <1283862729-17045-3-git-send-email-leiwen@marvell.com> References: <1283862729-17045-1-git-send-email-leiwen@marvell.com> <1283862729-17045-3-git-send-email-leiwen@marvell.com> Message-ID: <20100907135302.B45751506AA@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Lei Wen, In message <1283862729-17045-3-git-send-email-leiwen@marvell.com> you wrote: > Signed-off-by: Lei Wen > --- > common/cmd_mmc.c | 20 ++++++++++++++++++++ > disk/part.c | 3 +++ > 2 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c > index c0b30d8..af82984 100644 > --- a/common/cmd_mmc.c > +++ b/common/cmd_mmc.c > @@ -154,6 +154,25 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > mmc_init(mmc); > > return 0; > + } else if (strncmp(argv[1], "part", 4) == 0) { > + int dev = simple_strtoul(argv[2], NULL, 10); > + block_dev_desc_t *mmc_dev; > + struct mmc *mmc = find_mmc_device(dev); > + > + if (!mmc) > + return 1; Please print error message in case of errors. > + mmc_init(mmc); > + mmc_dev = mmc_get_dev(dev); > + if (mmc_dev != NULL && > + mmc_dev->type != DEV_TYPE_UNKNOWN) { > + rc = 1; > + print_part(mmc_dev); Do we need to set rc at all? Just do a "return 0" here. > + } > + if (!rc) { > + printf("\nno mmc devices available\n"); > + return 1; No leading newline, please. And use puts() for strings that do not need formatting. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Youth doesn't excuse everything. -- Dr. Janice Lester (in Kirk's body), "Turnabout Intruder", stardate 5928.5.