diff options
Diffstat (limited to 'commands/md.c')
-rw-r--r-- | commands/md.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/commands/md.c b/commands/md.c index 2389c12d14..f3758f571f 100644 --- a/commands/md.c +++ b/commands/md.c @@ -1,19 +1,5 @@ -/* - * Copyright (c) 2011 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: © 2011 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix /* * Memory Functions @@ -63,8 +49,10 @@ static int do_mem_md(int argc, char *argv[]) } fd = open_and_lseek(filename, mode | O_RDONLY, start); - if (fd < 0) + if (fd < 0) { + printf("Could not open \"%s\": %m\n", filename); return 1; + } map = memmap(fd, PROT_READ); if (map != MAP_FAILED) { @@ -73,7 +61,7 @@ static int do_mem_md(int argc, char *argv[]) goto out; } - buf = xmalloc(RW_BUF_SIZE); + buf = xzalloc(RW_BUF_SIZE + 7); do { now = min(size, (loff_t)RW_BUF_SIZE); @@ -102,7 +90,7 @@ out: BAREBOX_CMD_HELP_START(md) -BAREBOX_CMD_HELP_TEXT("Display (hex dump) a memory region.") +BAREBOX_CMD_HELP_TEXT("Display (hex dump) a memory REGION.") BAREBOX_CMD_HELP_TEXT("") BAREBOX_CMD_HELP_TEXT("Options:") BAREBOX_CMD_HELP_OPT ("-b", "byte access") @@ -122,7 +110,7 @@ BAREBOX_CMD_HELP_END BAREBOX_CMD_START(md) .cmd = do_mem_md, BAREBOX_CMD_DESC("memory display") - BAREBOX_CMD_OPTS("[-bwlsx] REGION") + BAREBOX_CMD_OPTS("[-bwlqx] [-s FILE] REGION") BAREBOX_CMD_GROUP(CMD_GRP_MEM) BAREBOX_CMD_HELP(cmd_md_help) BAREBOX_CMD_END |