All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH RESEND] usb: gadget: pxa25x_udc: fix use-before-initialized bug
@ 2015-01-08 17:51 Alex Sadovsky
  2015-01-10  0:42 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Sadovsky @ 2015-01-08 17:51 UTC (permalink / raw)
  To: u-boot

Fix use-before-initialized bug in pxa25x_udc driver.

Function usb_gadget_register_driver calls udc_disable,
and udc_disable calls pullup_off that uses dev->mach->udc_command.
But dev->mach is initialized in usb_gadget_register_driver after
calling udc_disable. This patch fixes the order of initialization.

Signed-off-by: Alex Sadovsky <Nable.MainInbox@googlemail.com>
---
I'm resending the patch with fixed 'Signed-off-by:' and 'From:' fields.
There are no changes in patch contents.

 drivers/usb/gadget/pxa25x_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 8945c5b..d4460b2 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1950,11 +1950,11 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
 	dev->watchdog.period = 5000 * CONFIG_SYS_HZ / 1000000; /* 5 ms */
 	dev->watchdog.function = udc_watchdog;
 
+	dev->mach = &mach_info;
+
 	udc_disable(dev);
 	udc_reinit(dev);
 
-	dev->mach = &mach_info;
-
 	dev->gadget.name = "pxa2xx_udc";
 	retval = driver->bind(&dev->gadget);
 	if (retval) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH RESEND] usb: gadget: pxa25x_udc: fix use-before-initialized bug
  2015-01-08 17:51 [U-Boot] [PATCH RESEND] usb: gadget: pxa25x_udc: fix use-before-initialized bug Alex Sadovsky
@ 2015-01-10  0:42 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2015-01-10  0:42 UTC (permalink / raw)
  To: u-boot

On Thursday, January 08, 2015 at 06:51:10 PM, Alex Sadovsky wrote:
> Fix use-before-initialized bug in pxa25x_udc driver.
> 
> Function usb_gadget_register_driver calls udc_disable,
> and udc_disable calls pullup_off that uses dev->mach->udc_command.
> But dev->mach is initialized in usb_gadget_register_driver after
> calling udc_disable. This patch fixes the order of initialization.
> 
> Signed-off-by: Alex Sadovsky <Nable.MainInbox@googlemail.com>

Applied, thanks!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-10  0:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 17:51 [U-Boot] [PATCH RESEND] usb: gadget: pxa25x_udc: fix use-before-initialized bug Alex Sadovsky
2015-01-10  0:42 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.