]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: composite: Fix function used to free memory
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 4 Jan 2017 05:30:16 +0000 (06:30 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 12 Jan 2017 07:58:05 +0000 (09:58 +0200)
'cdev->os_desc_req' has been allocated with 'usb_ep_alloc_request()' so
'usb_ep_free_request()' should be used to free it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/composite.c

index 002822d98fda207505581ca75cb47373db81fb78..49d685ad0da90d1a1282dd9d25f31ad64db22087 100644 (file)
@@ -2147,7 +2147,7 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
        cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
        if (!cdev->os_desc_req->buf) {
                ret = -ENOMEM;
-               kfree(cdev->os_desc_req);
+               usb_ep_free_request(ep0, cdev->os_desc_req);
                goto end;
        }
        cdev->os_desc_req->context = cdev;