From: Nable <nable.maininbox@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: gadget: pxa25x_udc: fix use-before-initialized bug
Date: Wed, 7 Jan 2015 21:23:52 +0300 [thread overview]
Message-ID: <1420655032-14097-1-git-send-email-Nable.MainInbox@googlemail.com> (raw)
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: Nable <Nable.MainInbox@googlemail.com>
---
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
next reply other threads:[~2015-01-07 18:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 18:23 Nable [this message]
2015-01-07 23:31 ` [U-Boot] [PATCH] usb: gadget: pxa25x_udc: fix use-before-initialized bug Marek Vasut
2015-01-08 8:38 ` Nable
2015-01-08 17:05 ` Marek Vasut
2015-01-08 18:19 ` Nable
2015-01-09 0:49 ` Marek Vasut
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=1420655032-14097-1-git-send-email-Nable.MainInbox@googlemail.com \
--to=nable.maininbox@googlemail.com \
--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