From: Andreas Jaeger <aj@suse.de>
To: grub-devel@gnu.org
Subject: Fix gcc 4.7 warning in usbtest.c
Date: Fri, 16 Mar 2012 10:10:32 +0100 [thread overview]
Message-ID: <4F630388.1090401@suse.de> (raw)
Building grub2 with gcc 4.7 snapshot, I see:
commands/usbtest.c: In function 'usb_print_str':
commands/usbtest.c:126:19: error: 'name' may be used uninitialized in
this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors
line 121 is:
121: err = grub_usb_get_string (dev, idx, 0x0409, &name);
gcc does not seem to understand that name is only set if
grub_usb_get_string returns without an error.
Here's the obvious patch to fix this,
Andreas
Index: grub-1.99/grub-core/commands/usbtest.c
===================================================================
--- grub-1.99.orig/grub-core/commands/usbtest.c
+++ grub-1.99/grub-core/commands/usbtest.c
@@ -111,7 +111,7 @@ grub_usb_get_string (grub_usb_device_t d
static void
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
{
- char *name;
+ char *name = NULL;
grub_usb_err_t err;
/* XXX: LANGID */
reply other threads:[~2012-03-16 14:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4F630388.1090401@suse.de \
--to=aj@suse.de \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.