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 <zhangyuanfang@codeaurora.org>
This commit is contained in:
Yuanfang Zhang 2020-11-03 17:22:43 +08:00
parent f1dda4158d
commit 922ca3d4c9

View file

@ -546,10 +546,9 @@ void usb_bypass_notifier(void *priv, unsigned int event,
if (!drvdata) if (!drvdata)
return; return;
if (tmcdrvdata->out_mode != TMC_ETR_OUT_MODE_USB if (tmcdrvdata->out_mode != TMC_ETR_OUT_MODE_USB) {
|| tmcdrvdata->mode == CS_MODE_DISABLED) {
dev_err(&tmcdrvdata->csdev->dev, 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; return;
} }
@ -564,6 +563,11 @@ void usb_bypass_notifier(void *priv, unsigned int event,
break; break;
case USB_QDSS_DISCONNECT: 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); usb_bypass_stop(drvdata);
break; break;