From: WANG Chao <chaowang@redhat.com>
To: kexec@lists.infradead.org, horms@verge.net.au
Subject: [PATCH] kexec, x86: Fix x86 build warnings
Date: Wed, 16 Oct 2013 14:25:22 +0800 [thread overview]
Message-ID: <1381904722-5289-1-git-send-email-chaowang@redhat.com> (raw)
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@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
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2013-10-16 6:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 6:25 WANG Chao [this message]
2013-10-17 5:29 ` [PATCH] kexec, x86: Fix x86 build warnings WANG Chao
2013-10-17 6:03 ` Baoquan He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381904722-5289-1-git-send-email-chaowang@redhat.com \
--to=chaowang@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox