* Fix gcc 4.7 warning in usbtest.c
@ 2012-03-16 9:10 Andreas Jaeger
0 siblings, 0 replies; only message in thread
From: Andreas Jaeger @ 2012-03-16 9:10 UTC (permalink / raw)
To: grub-devel
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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-16 14:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 9:10 Fix gcc 4.7 warning in usbtest.c Andreas Jaeger
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.