Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a7af2c9 authored by Saket Saurabh's avatar Saket Saurabh
Browse files

usb: Avoid incorrect memory leaks reported by kmemleak tool.



Certain memory allocations are not properly tracked by the kmemleak
tool, which causes it to incorrectly detect memory leaks. Notify the
tool by using kmemleak_not_leak() to ignore the memory allocation
so that incorrect leak reports are avoided.

CRs-Fixed: 612944
Change-Id: Ia15d94bb140f415a25d5b7e6996d3b985f33b28b
Signed-off-by: default avatarSaket Saurabh <ssaurabh@codeaurora.org>
parent 7198e5fb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/usb/gadget.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include <linux/kmemleak.h>

static DEFINE_SPINLOCK(ch_lock);
static LIST_HEAD(usb_diag_ch_list);
@@ -380,6 +381,7 @@ int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
		req = usb_ep_alloc_request(ctxt->in, GFP_ATOMIC);
		if (!req)
			goto fail;
		kmemleak_not_leak(req);
		req->complete = diag_write_complete;
		list_add_tail(&req->list, &ctxt->write_pool);
	}
@@ -388,6 +390,7 @@ int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
		req = usb_ep_alloc_request(ctxt->out, GFP_ATOMIC);
		if (!req)
			goto fail;
		kmemleak_not_leak(req);
		req->complete = diag_read_complete;
		list_add_tail(&req->list, &ctxt->read_pool);
	}