Re: [PATCH] usb: gadget: at91_udc: Check gpio lookup results

From: Felipe Balbi
Date: Fri Jul 26 2013 - 16:30:24 EST


On Fri, Jul 26, 2013 at 09:23:35AM -0700, Olof Johansson wrote:
> On Fri, Jul 26, 2013 at 2:54 AM, Felipe Balbi <balbi@xxxxxx> wrote:
> > On Thu, Jul 25, 2013 at 01:59:51PM -0700, Olof Johansson wrote:
> >> On Thu, Jul 25, 2013 at 10:19 AM, Felipe Balbi <balbi@xxxxxx> wrote:
> >> > On Thu, Jul 25, 2013 at 09:18:39AM -0700, Olof Johansson wrote:
> >> >> That's what the code does today, and I wasn't trying to second-guess
> >> >> their decisions on that. Chances are firmware, in some instances, have
> >> >> left power on so continuing might do no harm.
> >> >
> >> > fair enough, then let's just decrease the error message level to debug
> >> > or info.
> >>
> >> Fair enough. info seems appropriate (or warn). Want me to respin, or
> >> can you edit when you apply?
> >
> > please respin
>
> An older patch from Arnd that accomplishes the same warning removal
> has mysteriously showed up in -next in the last couple of days
> (ae40d64b1f2db93d7b092e6425a2f716289fbd09), even though commit date
> was July 15.
>
> So, might as well, drop this one.

doesn't look like the same thing:

commit ae40d64b1f2db93d7b092e6425a2f716289fbd09
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date: Wed Jun 19 13:27:27 2013 +0200

usb: gadget: at91_udc: call at91udc_of_init only when needed

This avoids a build error in at91sam9261_9g10_defconfig:

drivers/usb/gadget/at91_udc.c: In function 'at91udc_probe':
drivers/usb/gadget/at91_udc.c:1685:34: warning: 'flags' may be used uninitialized in this
function [-Wmaybe-uninitialized]
board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
^
drivers/usb/gadget/at91_udc.c:1678:21: note: 'flags' was declared here
enum of_gpio_flags flags;
^

Making the call to at91udc_of_init conditinal also reduces
the object code size without sacrificing build coverage.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxx>
Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 073b938..2cbab1c 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1725,7 +1725,7 @@ static int at91udc_probe(struct platform_device *pdev)
/* init software state */
udc = &controller;
udc->gadget.dev.parent = dev;
- if (pdev->dev.of_node)
+ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
at91udc_of_init(udc, pdev->dev.of_node);
else
memcpy(&udc->board, dev->platform_data,

--
balbi

Attachment: signature.asc
Description: Digital signature