[U-Boot] [PATCH 0/2] usb bug fixes

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(-)

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; } }

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++) {

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
participants (2)
-
Marek Vasut
-
Nikita Kiryanov