From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S8YNM-0002OL-R0 for mharc-grub-devel@gnu.org; Fri, 16 Mar 2012 10:43:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8TBf-00063f-UN for grub-devel@gnu.org; Fri, 16 Mar 2012 05:11:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8TBZ-0005XY-O6 for grub-devel@gnu.org; Fri, 16 Mar 2012 05:11:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59500 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8TBZ-0005XK-IC for grub-devel@gnu.org; Fri, 16 Mar 2012 05:10:57 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 47B0B89471 for ; Fri, 16 Mar 2012 10:10:55 +0100 (CET) Message-ID: <4F630388.1090401@suse.de> Date: Fri, 16 Mar 2012 10:10:32 +0100 From: Andreas Jaeger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Fix gcc 4.7 warning in usbtest.c Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 X-Mailman-Approved-At: Fri, 16 Mar 2012 10:43:27 -0400 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Mar 2012 09:11:09 -0000 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 */