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

Commit 14b94671 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Yabin Cui
Browse files

UPSTREAM: coresight: Properly address errors in sink::disable() functions



(Upstream commit 12dfc9e022aa4e8768d127416bf841c169f8c57e).

When disabling a sink the reference counter ensures the operation goes
through if nobody else is using it.  As such if drvdata::mode is already
set do CS_MODE_DISABLED, it is an error and should be reported as such.

Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Tested-by: default avatarRobert Walker <robert.walker@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 140266694
Change-Id: I541bfb6a7ae067b5327b8e76f700155f31b942ba
Signed-off-by: default avatarYabin Cui <yabinc@google.com>
parent 22611bfe
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -341,11 +341,10 @@ static int etb_disable(struct coresight_device *csdev)
		return -EBUSY;
	}

	/* Disable the ETB only if it needs to */
	if (drvdata->mode != CS_MODE_DISABLED) {
	/* Complain if we (somehow) got out of sync */
	WARN_ON_ONCE(drvdata->mode == CS_MODE_DISABLED);
	etb_disable_hw(drvdata);
	drvdata->mode = CS_MODE_DISABLED;
	}
	spin_unlock_irqrestore(&drvdata->spinlock, flags);

	dev_dbg(drvdata->dev, "ETB disabled\n");
+4 −5
Original line number Diff line number Diff line
@@ -300,11 +300,10 @@ static int tmc_disable_etf_sink(struct coresight_device *csdev)
		return -EBUSY;
	}

	/* Disable the TMC only if it needs to */
	if (drvdata->mode != CS_MODE_DISABLED) {
	/* Complain if we (somehow) got out of sync */
	WARN_ON_ONCE(drvdata->mode == CS_MODE_DISABLED);
	tmc_etb_disable_hw(drvdata);
	drvdata->mode = CS_MODE_DISABLED;
	}

	spin_unlock_irqrestore(&drvdata->spinlock, flags);

+4 −5
Original line number Diff line number Diff line
@@ -1417,11 +1417,10 @@ static int tmc_disable_etr_sink(struct coresight_device *csdev)
		return -EBUSY;
	}

	/* Disable the TMC only if it needs to */
	if (drvdata->mode != CS_MODE_DISABLED) {
	/* Complain if we (somehow) got out of sync */
	WARN_ON_ONCE(drvdata->mode == CS_MODE_DISABLED);
	tmc_etr_disable_hw(drvdata);
	drvdata->mode = CS_MODE_DISABLED;
	}

	spin_unlock_irqrestore(&drvdata->spinlock, flags);