]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
usb: gadget: f_thor: Fix request buffer freeing
authorMichal Simek <michal.simek@xilinx.com>
Wed, 24 Feb 2016 07:45:21 +0000 (08:45 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 4 Mar 2016 08:04:41 +0000 (09:04 +0100)
This patch fixes origin patch:
"usb: gadget: f_thor: free the allocated out request buffer"
(sha1: f63465733427b7bfbd0fe9c6d8ba3fb90189ad69)
by removing out_req_buf reference and using dev->out_req->buf
directly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/gadget/f_thor.c

index 75b72902c9d5669c8f1894eafcc4f8df4ea0bde5..cd4d9e659a39bb7b205a1898531194c71901c439 100644 (file)
@@ -51,7 +51,6 @@ DEFINE_CACHE_ALIGN_BUFFER(unsigned char, thor_rx_data_buf,
 DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE);
 static unsigned long long int thor_file_size;
 static int alt_setting_num;
-static void *out_req_buf;
 
 static void send_rsp(const struct rsp_box *rsp)
 {
@@ -892,8 +891,7 @@ static void thor_func_disable(struct usb_function *f)
        }
 
        if (dev->out_ep->driver_data) {
-               if (out_req_buf)
-                       free(out_req_buf);
+               free(dev->out_req->buf);
                dev->out_req->buf = NULL;
                usb_ep_free_request(dev->out_ep, dev->out_req);
                usb_ep_disable(dev->out_ep);
@@ -950,7 +948,6 @@ static int thor_eps_setup(struct usb_function *f)
        }
 
        dev->out_req = req;
-       out_req_buf = dev->out_req->buf;
        /* ACM control EP */
        ep = dev->int_ep;
        ep->driver_data = cdev; /* claim */