Re: [PATCH 3/3 v2] usb/dummy_hcd: allow to free requests on disabled endpoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 25 Jan 2012, Sebastian Andrzej Siewior wrote:

> On 01/25/2012 04:26 PM, Alan Stern wrote:
> >> diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
> >> index 4141b27..492909e 100644
> >> --- a/drivers/usb/gadget/dummy_hcd.c
> >> +++ b/drivers/usb/gadget/dummy_hcd.c
> >> @@ -596,14 +596,13 @@ static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,
> >>
> >>   static void dummy_free_request(struct usb_ep *_ep, struct usb_request *_req)
> >>   {
> >> -	struct dummy_ep		*ep;
> >>   	struct dummy_request	*req;
> >>
> >> -	if (!_ep || !_req)
> >> -		return;
> >> -	ep = usb_ep_to_dummy_ep(_ep);
> >> -	if (!ep->desc&&  _ep->name != ep0name)
> >> +	if (!_ep || !_req || (_ep->name == ep0name)) {
> >> +		pr_err("%s() Can not free req: ep %p req %p ep0? %d\n",
> >> +				__func__, _ep, _req, _ep->name == ep0name);
> >
> > I'd like to avoid pr_err.  Can you use dev_err instead?  Or just omit
> > the error message?
> 
> I leaked requests and did not know about it. So a message makes sense I
> guess. dev_err() is hardly possible since both (_ep and _req) might be
> NULL so don't always have struct device here. What about WARN_ON_ONCE ? 
> The backtrack is probably useful :)

That would be good.

Alan Stern

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux