Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300535 > unrolled thread

[PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails

Started byJia-Ju Bai <baijiaju1990@163.com>
First post2016-01-04 09:20 +0100
Last post2016-01-04 16:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails Jia-Ju Bai <baijiaju1990@163.com> - 2016-01-04 09:20 +0100
    Re: [PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt  fails Alan Stern <stern@rowland.harvard.edu> - 2016-01-04 16:30 +0100

#1300535 — [PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails

FromJia-Ju Bai <baijiaju1990@163.com>
Date2016-01-04 09:20 +0100
Subject[PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails
Message-ID<qN8wW-VH-5@gated-at.bofh.it>
The driver calls ehci_mem_init to allocate memory resources. 
But these resources are not freed when ehci_halt fails.

This patch adds "ehci_mem_cleanup" in error handling code to fix this problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 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 48c92bf..015b411 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -675,8 +675,10 @@ int ehci_setup(struct usb_hcd *hcd)
 		return retval;
 
 	retval = ehci_halt(ehci);
-	if (retval)
+	if (retval) {
+		ehci_mem_cleanup(ehci);
 		return retval;
+	}
 
 	ehci_reset(ehci);
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1300826 — Re: [PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-01-04 16:30 +0100
SubjectRe: [PATCH v2] ehci-hcd: Cleanup memory resources when ehci_halt fails
Message-ID<qNff4-5dA-23@gated-at.bofh.it>
In reply to#1300535
On Mon, 4 Jan 2016, Jia-Ju Bai wrote:

> The driver calls ehci_mem_init to allocate memory resources. 
> But these resources are not freed when ehci_halt fails.
> 
> This patch adds "ehci_mem_cleanup" in error handling code to fix this problem.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
> ---
>  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 48c92bf..015b411 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -675,8 +675,10 @@ int ehci_setup(struct usb_hcd *hcd)
>  		return retval;
>  
>  	retval = ehci_halt(ehci);
> -	if (retval)
> +	if (retval) {
> +		ehci_mem_cleanup(ehci);
>  		return retval;
> +	}
>  
>  	ehci_reset(ehci);
>  

Acked-by: Alan Stern <stern@rowland.harvard.edu>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web