From 922ca3d4c9811cd346b2edd9f2268e43b99bb2c7 Mon Sep 17 00:00:00 2001 From: Yuanfang Zhang Date: Tue, 3 Nov 2020 17:22:43 +0800 Subject: [PATCH] coresight: byte-cnter: Add ETR status check in bypass notifier when usb_bypass_notify is called by ush_qdss_close(), no need to response to USB_QDSS_DISCONNECT event. so add etr status check to avoid exception. Change-Id: I4ab5d7f4ba054b0d1ecc7026b5662ddc1c8b5ca1 Signed-off-by: Yuanfang Zhang --- drivers/hwtracing/coresight/coresight-byte-cntr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index 48756a8607aa..23eedba9c106 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -546,10 +546,9 @@ void usb_bypass_notifier(void *priv, unsigned int event, if (!drvdata) return; - if (tmcdrvdata->out_mode != TMC_ETR_OUT_MODE_USB - || tmcdrvdata->mode == CS_MODE_DISABLED) { + if (tmcdrvdata->out_mode != TMC_ETR_OUT_MODE_USB) { dev_err(&tmcdrvdata->csdev->dev, - "%s: ETR is not USB mode, or ETR is disabled.\n", __func__); + "%s: ETR is not USB mode\n", __func__); return; } @@ -564,6 +563,11 @@ void usb_bypass_notifier(void *priv, unsigned int event, break; case USB_QDSS_DISCONNECT: + if (tmcdrvdata->mode == CS_MODE_DISABLED) { + dev_err(&tmcdrvdata->csdev->dev, + "%s: ETR is disabled.\n", __func__); + return; + } usb_bypass_stop(drvdata); break;