[PATCH] kexec, x86: Fix x86 build warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gcc throw out three warnings:

kexec/arch/i386/kexec-elf-x86.c: In function ?elf_x86_load?:
kexec/arch/i386/kexec-elf-x86.c:97:6: warning: variable ?modified_cmdline_len? set but not used [-Wunused-but-set-variable]
  int modified_cmdline_len;
      ^
kexec/arch/i386/kexec-bzImage.c: In function ?do_bzImage_load?:
kexec/arch/i386/kexec-bzImage.c:110:8: warning: variable ?kernel_version? set but not used [-Wunused-but-set-variable]
  char *kernel_version;
        ^
kexec/arch/i386/kexec-x86-common.c: In function ?efi_map_added?:
kexec/arch/i386/kexec-x86-common.c:400:18: warning: variable ?res? set but not used [-Wunused-but-set-variable]
  char buf[512], *res;
                  ^
Fix these warnings by remove the unused variables for good.

Signed-off-by: WANG Chao <chaowang at redhat.com>
---
 kexec/arch/i386/kexec-bzImage.c    | 2 --
 kexec/arch/i386/kexec-elf-x86.c    | 3 ---
 kexec/arch/i386/kexec-x86-common.c | 4 ++--
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index fc1a54f..15c1b34 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -107,7 +107,6 @@ int do_bzImage_load(struct kexec_info *info,
 	struct x86_linux_header setup_header;
 	struct x86_linux_param_header *real_mode;
 	int setup_sects;
-	char *kernel_version;
 	size_t size;
 	int kern16_size;
 	unsigned long setup_base, setup_size;
@@ -133,7 +132,6 @@ int do_bzImage_load(struct kexec_info *info,
 	}
 
 	kern16_size = (setup_sects +1) *512;
-	kernel_version = ((char *)&setup_header) + 512 + setup_header.kver_addr;
 	if (kernel_len < kern16_size) {
 		fprintf(stderr, "BzImage truncated?\n");
 		return -1;
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
index d0f9838..de00dcb 100644
--- a/kexec/arch/i386/kexec-elf-x86.c
+++ b/kexec/arch/i386/kexec-elf-x86.c
@@ -94,7 +94,6 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
 	char *error_msg = NULL;
 	int result;
 	int command_line_len;
-	int modified_cmdline_len;
 	const char *ramdisk;
 	unsigned long entry, max_addr;
 	int arg_style;
@@ -123,7 +122,6 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
 	 * Parse the command line arguments
 	 */
 	arg_style = ARG_STYLE_ELF;
-	modified_cmdline_len = 0;
 	ramdisk = 0;
 	result = 0;
 	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
@@ -180,7 +178,6 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
 						COMMAND_LINE_SIZE);
 			modified_cmdline[COMMAND_LINE_SIZE - 1] = '\0';
 		}
-		modified_cmdline_len = strlen(modified_cmdline);
 	}
 
 	/* Load the ELF executable */
diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
index ed6c950..e5aa2a4 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -397,10 +397,10 @@ again:
  * @return 1 if parameter is present, 0 if not or if an error occurs.
  */
 int efi_map_added( void ) {
-	char buf[512], *res;
+	char buf[512];
 	FILE *fp = fopen( "/proc/cmdline", "r" );
 	if( fp ) {
-		res = fgets( buf, 512, fp );
+		fgets( buf, 512, fp );
 		fclose( fp );
 		return strstr( buf, "add_efi_memmap" ) != NULL;
 	} else {
-- 
1.8.3.1




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux