Skip to contentSkip to conversation

RAMDISK: Fix unused variable issue caused by raw rd support

PATCH New Marek Vasut 2 participants 2 messages Mar 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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]

---
 common/image.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/image.c +1 -1
index 103e0e6..d55d448 100644
@@ -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;
Signature · 1 line
1.7.9.1
#1 lore raw

PATCH 1/1 RAMDISK: Fix unused variable issue caused by raw rd support

Dear Marek Vasut,

Quoted 21 lines · In message <[email protected]> you wrote:

image.c: In function ?boot_get_ramdisk?:
image.c:800:8: warning: unused variable ?end? [-Wunused-variable]

---
 common/image.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/image.c +0 -1
index 103e0e6..d55d448 100644
@@ -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;

common/image.c int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, · line 999

Quoted 5 lines
common/image.c +1 -0
@@ -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

Signature · 6 lines
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
"In the face of entropy and nothingness, you kind of have to  pretend
it's  not  there  if  you  want  to  keep writing good code."
- Karl Lehenbauer