[U-Boot] [PATCH] RAMDISK: Fix unused variable issue caused by raw rd support

image.c: In function ‘boot_get_ramdisk’: image.c:800:8: warning: unused variable ‘end’ [-Wunused-variable]
Signed-off-by: Marek Vasut marex@denx.de --- common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/image.c b/common/image.c index 103e0e6..d55d448 100644 --- a/common/image.c +++ b/common/image.c @@ -797,7 +797,6 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ulong rd_addr, rd_load; ulong rd_data, rd_len; const image_header_t *rd_hdr; - char *end; #if defined(CONFIG_FIT) void *fit_hdr; const char *fit_uname_config = NULL; @@ -996,6 +995,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, #endif default: #ifdef CONFIG_SUPPORT_RAW_INITRD + char *end; if (argc >= 3 && (end = strchr(argv[2], ':'))) { rd_len = simple_strtoul(++end, NULL, 16); rd_data = rd_addr;

Dear Marek Vasut,
In message 1333142566-30899-1-git-send-email-marex@denx.de you wrote:
image.c: In function ‘boot_get_ramdisk’: image.c:800:8: warning: unused variable ‘end’ [-Wunused-variable]
Signed-off-by: Marek Vasut marex@denx.de
common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/image.c b/common/image.c index 103e0e6..d55d448 100644 --- a/common/image.c +++ b/common/image.c @@ -797,7 +797,6 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ulong rd_addr, rd_load; ulong rd_data, rd_len; const image_header_t *rd_hdr;
- char *end;
#if defined(CONFIG_FIT) void *fit_hdr; const char *fit_uname_config = NULL; @@ -996,6 +995,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, #endif default: #ifdef CONFIG_SUPPORT_RAW_INITRD
char *end; if (argc >= 3 && (end = strchr(argv[2], ':'))) {
This works only with CONFIG_SUPPORT_RAW_INITRD undefined.
Otherwise you get:
image.c: In function 'boot_get_ramdisk': image.c:1000: error: expected expression before 'char' image.c:1001: error: 'end' undeclared (first use in this function) image.c:1001: error: (Each undeclared identifier is reported only once image.c:1001: error: for each function it appears in.)
You need braces to start a new block.
Best regards,
Wolfgang Denk
participants (2)
-
Marek Vasut
-
Wolfgang Denk