From 3741fb2cfb8874a4cfa6631a4517fec3722cef20 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Wed, 7 Oct 2020 11:48:59 -0700 Subject: [PATCH] coresight: byte-cntr: Free USB requests when disconnected When receiving USB_QDSS_CONNECT notification, 255 USB requests are allocated before starting the worker thread to begin writing to USB QDSS function driver. Conversely when USB_QDSS_DISCONNECT is received, these requests need to be freed. Without doing so, besides causing a slow memory leak, the existing requests would get incorrectly re-used and may fail if the USB endpoint changed due to a composition switch. Change-Id: I328e110719fab374827ac69c8b60274f65ec81e2 Signed-off-by: Jack Pham --- drivers/hwtracing/coresight/coresight-byte-cntr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index 445f844c656f..aa83c3660778 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -572,6 +572,8 @@ void usb_bypass_notifier(void *priv, unsigned int event, case USB_QDSS_DISCONNECT: usb_bypass_stop(drvdata); + flush_work(&(drvdata->read_work)); + usb_qdss_free_req(tmcdrvdata->usbch); break; case USB_QDSS_DATA_WRITE_DONE: