u-boot/common/cmd_df.c
Wolfgang Denk 47e26b1bf9 cmd_usage(): simplify return code handling
Lots of code use this construct:

	cmd_usage(cmdtp);
	return 1;

Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by

	return cmd_usage(cmdtp);

This fixes a few places with incorrect return code handling, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:43:57 +02:00

36 lines
612 B
C

/*
* Command for accessing DataFlash.
*
* Copyright (C) 2008 Atmel Corporation
*/
#include <common.h>
#include <df.h>
static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const char *cmd;
/* need at least two arguments */
if (argc < 2)
goto usage;
cmd = argv[1];
if (strcmp(cmd, "init") == 0) {
df_init(0, 0, 1000000);
return 0;
}
if (strcmp(cmd, "info") == 0) {
df_show_info();
return 0;
}
usage:
return cmd_usage(cmdtp);
}
U_BOOT_CMD(
sf, 2, 1, do_serial_flash,
"Serial flash sub-system",
"probe [bus:]cs - init flash device on given SPI bus and CS")