diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-09-07 02:54:25 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 09:19:47 -0400 |
commit | 162ca3ca613e02e115ec9c5273f94bd22dad0af2 (patch) | |
tree | ef048bd3f830c5234c2a36b4c4d7fa18fe11034e /drivers/usb/gadget/at91_udc.c | |
parent | d80c304bcacaf340efa29364ed0107f5c30378c8 (diff) |
usb: gadget: at91_udc: move the dereference below the NULL test
The dereference should be moved below the NULL test.
spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/at91_udc.c')
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index c9e66dfb02e6..d95f6b079345 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -469,7 +469,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
469 | const struct usb_endpoint_descriptor *desc) | 469 | const struct usb_endpoint_descriptor *desc) |
470 | { | 470 | { |
471 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); | 471 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); |
472 | struct at91_udc *udc = ep->udc; | 472 | struct at91_udc *udc; |
473 | u16 maxpacket; | 473 | u16 maxpacket; |
474 | u32 tmp; | 474 | u32 tmp; |
475 | unsigned long flags; | 475 | unsigned long flags; |
@@ -484,6 +484,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
484 | return -EINVAL; | 484 | return -EINVAL; |
485 | } | 485 | } |
486 | 486 | ||
487 | udc = ep->udc; | ||
487 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { | 488 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { |
488 | DBG("bogus device state\n"); | 489 | DBG("bogus device state\n"); |
489 | return -ESHUTDOWN; | 490 | return -ESHUTDOWN; |