diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2016-07-16 08:34:33 +0200 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-11 14:09:46 +0200 |
commit | 3887db5c2b6531c59e9649a4293071b575d6eb3b (patch) | |
tree | 250d34c06e41516fcceb1fe8e851b64fb84d5fad /drivers/usb/gadget/composite.c | |
parent | usb: gadget: uvc: Fix return value in case of error (diff) | |
download | linux-3887db5c2b6531c59e9649a4293071b575d6eb3b.tar.xz linux-3887db5c2b6531c59e9649a4293071b575d6eb3b.zip |
usb: gadget: composite: Fix return value in case of error
In 'composite_os_desc_req_prepare', if one of the memory allocations fail,
0 will be returned, which means success.
We should return -ENOMEM instead.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a8ecc7a612b9..5ebe6af7976e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2126,14 +2126,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; } |