mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 05:20:58 +07:00
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>
This commit is contained in:
parent
bd610c5aa9
commit
3887db5c2b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user