public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] USB: get rid of warning when compile with debug enabled
Date: Mon, 25 Aug 2014 12:43:18 +0200	[thread overview]
Message-ID: <201408251243.18740.marex@denx.de> (raw)
In-Reply-To: <1408958599-13518-1-git-send-email-voice.shen@atmel.com>

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 <voice.shen@atmel.com>
> ---
> 
>  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

  reply	other threads:[~2014-08-25 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  9:23 [U-Boot] [RFC PATCH] USB: get rid of warning when compile with debug enabled Bo Shen
2014-08-25 10:43 ` Marek Vasut [this message]
2014-08-26  1:11   ` Bo Shen
2014-08-26  6:46     ` Marek Vasut
2014-08-27  7:39       ` Bo Shen
2014-08-27 17:45         ` Marek Vasut
2014-08-27 19:48           ` Tom Rini
2014-08-27 20:24             ` Marek Vasut
2014-08-27 21:20               ` Tom Rini
2014-08-27 21:36                 ` Marek Vasut
2014-08-28  5:48                   ` Bo Shen
2014-08-28 15:18                   ` Tom Rini

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=201408251243.18740.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox