Re: [PATCH 1/2] USB: core: Fix build warning in usb_get_configuration()

From: Johan Hovold
Date: Wed Feb 26 2020 - 05:09:25 EST


On Wed, Feb 26, 2020 at 04:35:48PM +0800, Tiezhu Yang wrote:
> On 02/26/2020 04:04 PM, Johan Hovold wrote:
> > On Wed, Feb 26, 2020 at 02:15:22PM +0800, Tiezhu Yang wrote:
> >> There is no functional issue, just fix the following build warning:
> >>
> >> CC drivers/usb/core/config.o
> >> drivers/usb/core/config.c: In function âusb_get_configurationâ:
> >> drivers/usb/core/config.c:868:6: warning: âresultâ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >> int result;
> >> ^
> > What compiler are you using? The warning is clearly bogus and it hasn't
> > been seen with any recent gcc at least.
>
> [yangtiezhu@linux ~]$ gcc --version
> gcc (GCC) 4.9.4 20160726 (Red Hat 4.9.4-14)
> Copyright (C) 2015 Free Software Foundation, Inc.
>
> The gcc version I used maybe too old,
> if the warning is bogus, please ignore this patch.

Hmm. I even tried installing 4.9.4 and still don't see that warning (on
x86).

Are you sure that's the compiler version you use?

We've silenced bogus maybe-uninitialized warnings for 4.9 and newer
before, but we shouldn't be adding compiler workarounds unless we have
to.

Johan