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


Groups > linux.kernel > #1211033 > unrolled thread

[PATCH] usb: gadget: fix possible regression introduced with ep->claimed

Started byRobert Baldyga <r.baldyga@samsung.com>
First post2015-08-21 11:10 +0200
Last post2015-08-21 22:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: gadget: fix possible regression introduced with  ep->claimed Robert Baldyga <r.baldyga@samsung.com> - 2015-08-21 11:10 +0200
    Re: [PATCH] usb: gadget: fix possible regression introduced with  ep->claimed Felipe Balbi <balbi@ti.com> - 2015-08-21 17:10 +0200
      Re: [PATCH] usb: gadget: fix possible regression introduced with  ep->claimed Felipe Balbi <balbi@ti.com> - 2015-08-21 22:30 +0200

#1211033 — [PATCH] usb: gadget: fix possible regression introduced with ep->claimed

FromRobert Baldyga <r.baldyga@samsung.com>
Date2015-08-21 11:10 +0200
Subject[PATCH] usb: gadget: fix possible regression introduced with ep->claimed
Message-ID<pZQuL-7xY-23@gated-at.bofh.it>
This patch fixes possible regression introduced by patch reworking endpoint
claiming mechanism. It restores setring ep->driver_data to NULL in
usb_ep_autoconfig_reset(), which was removed by patch [1].

[1] commit cc476b42a39d ("usb: gadget: encapsulate endpoint claiming
    mechanism")

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---

Hi Felipe,

I was not able to reproduce the problem that you have described (functions
trying to enable eps that are already enabled, and disable eps that are
already disabled), but I have analysed the problem and I have concluded
that the only possible cause of regression can be that my patch removed
setting ep->driver_data to NULL in usb_ep_autoconfig_reset() function.
Because of this change initial state of ep->driver_data could be non-NULL
value, which could change behavoiur of some functions. I can't imagine
any other possible cause of regression introduced by such simple patch.

Thanks,
Robert

 drivers/usb/gadget/epautoconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 978435a..6399c10 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -186,6 +186,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
 
 	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
 		ep->claimed = false;
+		ep->driver_data = NULL;
 	}
 	gadget->in_epnum = 0;
 	gadget->out_epnum = 0;
-- 
1.9.1

--
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]


#1211208

FromFelipe Balbi <balbi@ti.com>
Date2015-08-21 17:10 +0200
Message-ID<pZW77-7dY-7@gated-at.bofh.it>
In reply to#1211033

[Multipart message — attachments visible in raw view] — view raw

On Fri, Aug 21, 2015 at 11:01:29AM +0200, Robert Baldyga wrote:
> This patch fixes possible regression introduced by patch reworking endpoint
> claiming mechanism. It restores setring ep->driver_data to NULL in
> usb_ep_autoconfig_reset(), which was removed by patch [1].
> 
> [1] commit cc476b42a39d ("usb: gadget: encapsulate endpoint claiming
>     mechanism")
> 
> Reported-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> ---
> 
> Hi Felipe,
> 
> I was not able to reproduce the problem that you have described (functions
> trying to enable eps that are already enabled, and disable eps that are
> already disabled), but I have analysed the problem and I have concluded

it happens with all, you can't see it because dwc3 (only) has a WARN()
for when an endpoint is enabled and has previously been enabled
(drivers/usb/dwc3/gadget.c). If you track your endpoint's state
regarding being enabled or not, you can add a WARN() to see the error.

> that the only possible cause of regression can be that my patch removed
> setting ep->driver_data to NULL in usb_ep_autoconfig_reset() function.
> Because of this change initial state of ep->driver_data could be non-NULL
> value, which could change behavoiur of some functions. I can't imagine
> any other possible cause of regression introduced by such simple patch.

yeah, I'll test this later.

> 
> Thanks,
> Robert
> 
>  drivers/usb/gadget/epautoconf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
> index 978435a..6399c10 100644
> --- a/drivers/usb/gadget/epautoconf.c
> +++ b/drivers/usb/gadget/epautoconf.c
> @@ -186,6 +186,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
>  
>  	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
>  		ep->claimed = false;
> +		ep->driver_data = NULL;
>  	}
>  	gadget->in_epnum = 0;
>  	gadget->out_epnum = 0;
> -- 
> 1.9.1
> 

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1211314

FromFelipe Balbi <balbi@ti.com>
Date2015-08-21 22:30 +0200
Message-ID<q016N-5Vh-3@gated-at.bofh.it>
In reply to#1211208

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Fri, Aug 21, 2015 at 10:00:50AM -0500, Felipe Balbi wrote:
> On Fri, Aug 21, 2015 at 11:01:29AM +0200, Robert Baldyga wrote:
> > This patch fixes possible regression introduced by patch reworking endpoint
> > claiming mechanism. It restores setring ep->driver_data to NULL in
> > usb_ep_autoconfig_reset(), which was removed by patch [1].
> > 
> > [1] commit cc476b42a39d ("usb: gadget: encapsulate endpoint claiming
> >     mechanism")
> > 
> > Reported-by: Felipe Balbi <balbi@ti.com>
> > Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> > ---
> > 
> > Hi Felipe,
> > 
> > I was not able to reproduce the problem that you have described (functions
> > trying to enable eps that are already enabled, and disable eps that are
> > already disabled), but I have analysed the problem and I have concluded
> 
> it happens with all, you can't see it because dwc3 (only) has a WARN()
> for when an endpoint is enabled and has previously been enabled
> (drivers/usb/dwc3/gadget.c). If you track your endpoint's state
> regarding being enabled or not, you can add a WARN() to see the error.
> 
> > that the only possible cause of regression can be that my patch removed
> > setting ep->driver_data to NULL in usb_ep_autoconfig_reset() function.
> > Because of this change initial state of ep->driver_data could be non-NULL
> > value, which could change behavoiur of some functions. I can't imagine
> > any other possible cause of regression introduced by such simple patch.
> 
> yeah, I'll test this later.

this has been running for many hours and I couldn't find any problems so
far. Just in case, I'll keep it running, but I doubt we'll find
anything. Once -rc1 is tagged, I'll send this to Greg.

thanks

-- 
balbi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web