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

Commit 7cdbbb1f authored by Tao Zhang's avatar Tao Zhang Committed by Yuanfang Zhang
Browse files

coresight: byte-cntr: Add ETR status check in bypass notifier



Add ETR status check while receiving USB_QDSS_CONNECT event.
Otherwise, there will cause crash due to NULL pointer issue.
Since ETR buffer will be released if ETR is disabled.

Change-Id: I358d25477c938844df5bff5c29ddbee307b770e3
Signed-off-by: default avatarTao Zhang <taozha@codeaurora.org>
parent f1dda415
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 *
 * Description: CoreSight Trace Memory Controller driver
 */
@@ -555,6 +555,11 @@ void usb_bypass_notifier(void *priv, unsigned int event,

	switch (event) {
	case USB_QDSS_CONNECT:
		if (tmcdrvdata->mode == CS_MODE_DISABLED) {
			dev_err_ratelimited(&tmcdrvdata->csdev->dev,
			 "%s: ETR is disabled.\n", __func__);
			return;
		}
		ret = usb_bypass_start(drvdata);
		if (ret < 0)
			return;