[U-Boot] [PATCH 3/3] MMC: print out avaible partition table

Wolfgang Denk wd at denx.de
Tue Sep 7 15:53:02 CEST 2010


Dear Lei Wen,

In message <1283862729-17045-3-git-send-email-leiwen at marvell.com> you wrote:
> Signed-off-by: Lei Wen <leiwen at marvell.com>
> ---
>  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.


More information about the U-Boot mailing list