The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Olof Johansson <olof@lixom.net>
Cc: Felipe Balbi <balbi@ti.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: gadget: at91_udc: Check gpio lookup results
Date: Thu, 25 Jul 2013 19:14:06 +0300	[thread overview]
Message-ID: <20130725161406.GD31835@radagast> (raw)
In-Reply-To: <1374605750-29565-1-git-send-email-olof@lixom.net>

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

Hi,

On Tue, Jul 23, 2013 at 11:55:50AM -0700, Olof Johansson wrote:
> This resolves the following valid build warning:
> 
> drivers/usb/gadget/at91_udc.c:1685:34: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> I switched from ? : to !! mostly to save from wrapping the lines while
> I was at it.
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
> 
> Felipe, this would be nice to see fixed for 3.11 but I'd argue that it's
> been here long enough to not really be needed for -stable.
> 
>  drivers/usb/gadget/at91_udc.c |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
> index 073b938..f3dbcd0 100644
> --- a/drivers/usb/gadget/at91_udc.c
> +++ b/drivers/usb/gadget/at91_udc.c
> @@ -1682,12 +1682,20 @@ static void at91udc_of_init(struct at91_udc *udc,
>  
>  	board->vbus_pin = of_get_named_gpio_flags(np, "atmel,vbus-gpio", 0,
>  						  &flags);
> -	board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
> +	if (board->vbus_pin < 0)
> +		pr_err("%s: Failed to get atmel,vbus-gpio property\n",
> +		       np->full_name);
> +	else
> +		board->vbus_active_low = !!(flags & OF_GPIO_ACTIVE_LOW);

should you even continue if you can't get the gpio ? If this gpio is
optional, then it's not really and error, rather a debugging or
informational message.

BTW, this vbus-gpio looks, to me at least, like a fixed regulator
controlled by a GPIO, no ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-07-25 16:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 18:55 [PATCH] usb: gadget: at91_udc: Check gpio lookup results Olof Johansson
2013-07-25 16:14 ` Felipe Balbi [this message]
2013-07-25 16:18   ` Olof Johansson
2013-07-25 17:19     ` Felipe Balbi
2013-07-25 20:59       ` Olof Johansson
2013-07-26  9:54         ` Felipe Balbi
2013-07-26 16:23           ` Olof Johansson
2013-07-26 20:30             ` Felipe Balbi
2013-07-26 20:47               ` Olof Johansson

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=20130725161406.GD31835@radagast \
    --to=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=olof@lixom.net \
    /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