From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 25 Aug 2014 12:43:18 +0200 Subject: [U-Boot] [RFC PATCH] USB: get rid of warning when compile with debug enabled In-Reply-To: <1408958599-13518-1-git-send-email-voice.shen@atmel.com> References: <1408958599-13518-1-git-send-email-voice.shen@atmel.com> Message-ID: <201408251243.18740.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, August 25, 2014 at 11:23:19 AM, Bo Shen wrote: > When compile with debug information is enabled, if call > spin_lock_irqsave, it will give following warning information. > This patch is used to get rid of it. > --->8--- > warning: 'flags' is used uninitialized in this function [-Wuninitialized] > ---8<--- The patch is wrong. The compiler complains that flags might be used uninited because that is the case -- you call spin_lock_irqsave() with uninited flags and because debug() is expanded to printf() I guess, the compiler spews. So which file does this warning come from ? > Signed-off-by: Bo Shen > --- > > include/usb/lin_gadget_compat.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/usb/lin_gadget_compat.h > b/include/usb/lin_gadget_compat.h index a25e9d9..fb525e7 100644 > --- a/include/usb/lin_gadget_compat.h > +++ b/include/usb/lin_gadget_compat.h > @@ -15,7 +15,7 @@ > /* common */ > #define spin_lock_init(...) > #define spin_lock(...) > -#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while > (0) +#define spin_lock_irqsave(lock, flags) do { flags = 1; debug("%lu\n", > flags); } while (0) #define spin_unlock(...) > #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0) > #define disable_irq(...) Best regards, Marek Vasut