All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] usb bug fixes
@ 2013-07-29 10:27 Nikita Kiryanov
  2013-07-29 10:27 ` [U-Boot] [PATCH 1/2] usb_hub: fix power cycling logic Nikita Kiryanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nikita Kiryanov @ 2013-07-29 10:27 UTC (permalink / raw)
  To: u-boot

This series contains two usb related bug fixes, one regarding the power cycling
of hub ports, and the other- a memory leak in ehci-hcd.

Cc: Marek Vasut <marex@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>

Nikita Kiryanov (2):
  usb_hub: fix power cycling logic
  ehci-hcd: fix memory leak in lowlevel init

 common/usb_hub.c            | 4 ++--
 drivers/usb/host/ehci-hcd.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
1.8.1.2

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

* [U-Boot] [PATCH 1/2] usb_hub: fix power cycling logic
  2013-07-29 10:27 [U-Boot] [PATCH 0/2] usb bug fixes Nikita Kiryanov
@ 2013-07-29 10:27 ` Nikita Kiryanov
  2013-07-29 10:27 ` [U-Boot] [PATCH 2/2] ehci-hcd: fix memory leak in lowlevel init Nikita Kiryanov
  2013-07-29 21:02 ` [U-Boot] [PATCH 0/2] usb bug fixes Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Nikita Kiryanov @ 2013-07-29 10:27 UTC (permalink / raw)
  To: u-boot

When power cycling the hub ports, a misbehaving port will prevent all ports
from being powered on because we quit at the first sign of trouble.

Skip problematic ports instead of failing the entire power on.

Cc: Marek Vasut <marex@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
 common/usb_hub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index 754d436..a11b401 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -110,7 +110,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 		ret = usb_get_port_status(dev, i + 1, portsts);
 		if (ret < 0) {
 			debug("port %d: get_port_status failed\n", i + 1);
-			return;
+			continue;
 		}
 
 		/*
@@ -125,7 +125,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 		portstatus = le16_to_cpu(portsts->wPortStatus);
 		if (portstatus & (USB_PORT_STAT_POWER << 1)) {
 			debug("port %d: Port power change failed\n", i + 1);
-			return;
+			continue;
 		}
 	}
 
-- 
1.8.1.2

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

* [U-Boot] [PATCH 2/2] ehci-hcd: fix memory leak in lowlevel init
  2013-07-29 10:27 [U-Boot] [PATCH 0/2] usb bug fixes Nikita Kiryanov
  2013-07-29 10:27 ` [U-Boot] [PATCH 1/2] usb_hub: fix power cycling logic Nikita Kiryanov
@ 2013-07-29 10:27 ` Nikita Kiryanov
  2013-07-29 21:02 ` [U-Boot] [PATCH 0/2] usb bug fixes Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Nikita Kiryanov @ 2013-07-29 10:27 UTC (permalink / raw)
  To: u-boot

usb_lowlevel_init() allocates a new periodic_list each time it is invoked,
without freeing the original list. Since it is initialized later on in the code,
just reuse the first-allocated list in future invocations of usb_lowlevel_init.

Cc: Marek Vasut <marex@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
 drivers/usb/host/ehci-hcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 706cf0c..eab1046 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -954,7 +954,9 @@ int usb_lowlevel_init(int index, void **controller)
 	 *         Split Transactions will be spread across microframes using
 	 *         S-mask and C-mask.
 	 */
-	ehcic[index].periodic_list = memalign(4096, 1024*4);
+	if (ehcic[index].periodic_list == NULL)
+		ehcic[index].periodic_list = memalign(4096, 1024 * 4);
+
 	if (!ehcic[index].periodic_list)
 		return -ENOMEM;
 	for (i = 0; i < 1024; i++) {
-- 
1.8.1.2

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

* [U-Boot] [PATCH 0/2] usb bug fixes
  2013-07-29 10:27 [U-Boot] [PATCH 0/2] usb bug fixes Nikita Kiryanov
  2013-07-29 10:27 ` [U-Boot] [PATCH 1/2] usb_hub: fix power cycling logic Nikita Kiryanov
  2013-07-29 10:27 ` [U-Boot] [PATCH 2/2] ehci-hcd: fix memory leak in lowlevel init Nikita Kiryanov
@ 2013-07-29 21:02 ` Marek Vasut
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2013-07-29 21:02 UTC (permalink / raw)
  To: u-boot

Dear Nikita Kiryanov,

> This series contains two usb related bug fixes, one regarding the power
> cycling of hub ports, and the other- a memory leak in ehci-hcd.
> 
> Cc: Marek Vasut <marex@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> 
> Nikita Kiryanov (2):
>   usb_hub: fix power cycling logic
>   ehci-hcd: fix memory leak in lowlevel init
> 
>  common/usb_hub.c            | 4 ++--
>  drivers/usb/host/ehci-hcd.c | 4 +++-
>  2 files changed, 5 insertions(+), 3 deletions(-)

Applied both, thanks!

Best regards,
Marek Vasut

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

end of thread, other threads:[~2013-07-29 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 10:27 [U-Boot] [PATCH 0/2] usb bug fixes Nikita Kiryanov
2013-07-29 10:27 ` [U-Boot] [PATCH 1/2] usb_hub: fix power cycling logic Nikita Kiryanov
2013-07-29 10:27 ` [U-Boot] [PATCH 2/2] ehci-hcd: fix memory leak in lowlevel init Nikita Kiryanov
2013-07-29 21:02 ` [U-Boot] [PATCH 0/2] usb bug fixes 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.