Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1303580 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2016-01-07 14:10 +0100 |
| Last post | 2016-01-08 07:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] usb: gadget: fix error handling Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-07 14:10 +0100
Re: [PATCH] usb: gadget: fix error handling Peter Chen <hzpeterchen@gmail.com> - 2016-01-08 07:10 +0100
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2016-01-07 14:10 +0100 |
| Subject | [PATCH] usb: gadget: fix error handling |
| Message-ID | <qOiuf-6b-27@gated-at.bofh.it> |
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
--
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]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-01-08 07:10 +0100 |
| Message-ID | <qOypk-2DF-11@gated-at.bofh.it> |
| In reply to | #1303580 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web