Re: [PATCH v1 10/14] usb: dwc2: host: free status_buf on hcd de-init

2015-11-04 Thread Herrero, Gregory
On Thu, Nov 05, 2015 at 12:10:57AM +, John Youn wrote:
> On 10/12/2015 2:18 AM, Gregory Herrero wrote:
> > status_buf needs to be freed in dwc2_hcd_remove().
> > 
> > Signed-off-by: Gregory Herrero 
> > ---
> >  drivers/usb/dwc2/hcd.c | 19 ++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> > index af4e4a2..41c00e9 100644
> > --- a/drivers/usb/dwc2/hcd.c
> > +++ b/drivers/usb/dwc2/hcd.c
> > @@ -3141,7 +3141,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
> >  */
> > retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
> > if (retval < 0)
> > -   goto error3;
> > +   goto error4;
> >  
> > device_wakeup_enable(hcd->self.controller);
> >  
> > @@ -3151,6 +3151,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
> >  
> > return 0;
> >  
> > +error4:
> > +   if (hsotg->core_params->dma_enable > 0)
> > +   dma_free_coherent(hsotg->dev,
> > + DWC2_HCD_STATUS_BUF_SIZE,
> > + hsotg->status_buf,
> > + hsotg->status_buf_dma);
> > +   else
> > +   kfree(hsotg->status_buf);
> >  error3:
> > dwc2_hcd_release(hsotg);
> >  error2:
> > @@ -3191,6 +3199,15 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg)
> >  
> > usb_remove_hcd(hcd);
> > hsotg->priv = NULL;
> > +
> > +   if (hsotg->core_params->dma_enable > 0)
> > +   dma_free_coherent(hsotg->dev,
> > + DWC2_HCD_STATUS_BUF_SIZE,
> > + hsotg->status_buf,
> > + hsotg->status_buf_dma);
> > +   else
> > +   kfree(hsotg->status_buf);
> > +
> > dwc2_hcd_release(hsotg);
> > usb_put_hcd(hcd);
> >  
> > 
> 
> This is already getting done in dwc2_hcd_free() which is reached
> from both of these code paths.
> 
> Is this patch needed for some other reason?
> 
Right, I missed it in dwc2_hcd_release().
I will remove this patch and resubmit.

Thanks,
Gregory
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 10/14] usb: dwc2: host: free status_buf on hcd de-init

2015-11-04 Thread John Youn
On 10/12/2015 2:18 AM, Gregory Herrero wrote:
> status_buf needs to be freed in dwc2_hcd_remove().
> 
> Signed-off-by: Gregory Herrero 
> ---
>  drivers/usb/dwc2/hcd.c | 19 ++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index af4e4a2..41c00e9 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -3141,7 +3141,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
>*/
>   retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
>   if (retval < 0)
> - goto error3;
> + goto error4;
>  
>   device_wakeup_enable(hcd->self.controller);
>  
> @@ -3151,6 +3151,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
>  
>   return 0;
>  
> +error4:
> + if (hsotg->core_params->dma_enable > 0)
> + dma_free_coherent(hsotg->dev,
> +   DWC2_HCD_STATUS_BUF_SIZE,
> +   hsotg->status_buf,
> +   hsotg->status_buf_dma);
> + else
> + kfree(hsotg->status_buf);
>  error3:
>   dwc2_hcd_release(hsotg);
>  error2:
> @@ -3191,6 +3199,15 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg)
>  
>   usb_remove_hcd(hcd);
>   hsotg->priv = NULL;
> +
> + if (hsotg->core_params->dma_enable > 0)
> + dma_free_coherent(hsotg->dev,
> +   DWC2_HCD_STATUS_BUF_SIZE,
> +   hsotg->status_buf,
> +   hsotg->status_buf_dma);
> + else
> + kfree(hsotg->status_buf);
> +
>   dwc2_hcd_release(hsotg);
>   usb_put_hcd(hcd);
>  
> 

This is already getting done in dwc2_hcd_free() which is reached
from both of these code paths.

Is this patch needed for some other reason?

John

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1 10/14] usb: dwc2: host: free status_buf on hcd de-init

2015-10-12 Thread Gregory Herrero
status_buf needs to be freed in dwc2_hcd_remove().

Signed-off-by: Gregory Herrero 
---
 drivers/usb/dwc2/hcd.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index af4e4a2..41c00e9 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -3141,7 +3141,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
 */
retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (retval < 0)
-   goto error3;
+   goto error4;
 
device_wakeup_enable(hcd->self.controller);
 
@@ -3151,6 +3151,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
 
return 0;
 
+error4:
+   if (hsotg->core_params->dma_enable > 0)
+   dma_free_coherent(hsotg->dev,
+ DWC2_HCD_STATUS_BUF_SIZE,
+ hsotg->status_buf,
+ hsotg->status_buf_dma);
+   else
+   kfree(hsotg->status_buf);
 error3:
dwc2_hcd_release(hsotg);
 error2:
@@ -3191,6 +3199,15 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg)
 
usb_remove_hcd(hcd);
hsotg->priv = NULL;
+
+   if (hsotg->core_params->dma_enable > 0)
+   dma_free_coherent(hsotg->dev,
+ DWC2_HCD_STATUS_BUF_SIZE,
+ hsotg->status_buf,
+ hsotg->status_buf_dma);
+   else
+   kfree(hsotg->status_buf);
+
dwc2_hcd_release(hsotg);
usb_put_hcd(hcd);
 
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html