All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: fix error handling
@ 2016-01-07 13:00 Sudip Mukherjee
  2016-01-08  6:01 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-01-07 13:00 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb, Sudip Mukherjee

We are doing PTR_ERR() of NULL, and that will actually make ret = 0.
So incase of both error and success we are actually returning the
success code.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/usb/gadget/composite.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 8b14c2a..17ce6b5 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2017,14 +2017,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
 
 	cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL);
 	if (!cdev->os_desc_req) {
-		ret = PTR_ERR(cdev->os_desc_req);
+		ret = -ENOMEM;
 		goto end;
 	}
 
 	/* OS feature descriptor length <= 4kB */
 	cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
 	if (!cdev->os_desc_req->buf) {
-		ret = PTR_ERR(cdev->os_desc_req->buf);
+		ret = -ENOMEM;
 		kfree(cdev->os_desc_req);
 		goto end;
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: fix error handling
  2016-01-07 13:00 [PATCH] usb: gadget: fix error handling Sudip Mukherjee
@ 2016-01-08  6:01 ` Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2016-01-08  6:01 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Felipe Balbi, Greg Kroah-Hartman, linux-kernel, linux-usb

On Thu, Jan 07, 2016 at 06:30:37PM +0530, Sudip Mukherjee wrote:
> We are doing PTR_ERR() of NULL, and that will actually make ret = 0.
> So incase of both error and success we are actually returning the
> success code.
> 

%s/incase of/in case of

Reviewed-by: Peter Cen <peter.chen@freescale.com>

> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/usb/gadget/composite.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 8b14c2a..17ce6b5 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -2017,14 +2017,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
>  
>  	cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL);
>  	if (!cdev->os_desc_req) {
> -		ret = PTR_ERR(cdev->os_desc_req);
> +		ret = -ENOMEM;
>  		goto end;
>  	}
>  
>  	/* OS feature descriptor length <= 4kB */
>  	cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
>  	if (!cdev->os_desc_req->buf) {
> -		ret = PTR_ERR(cdev->os_desc_req->buf);
> +		ret = -ENOMEM;
>  		kfree(cdev->os_desc_req);
>  		goto end;
>  	}
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Best Regards,
Peter Chen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-08  6:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 13:00 [PATCH] usb: gadget: fix error handling Sudip Mukherjee
2016-01-08  6:01 ` Peter Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.