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

Commit aeb8972b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "coresight: take lock before modifying byte cntr value"

parents 93bd1fd6 2d5f553d
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -1295,16 +1295,26 @@ static ssize_t tmc_etr_store_byte_cntr_value(struct device *dev,
	struct tmc_drvdata *drvdata = dev_get_drvdata(dev->parent);
	unsigned long val;

	if (!drvdata->byte_cntr_present || drvdata->byte_cntr_enable)
	mutex_lock(&drvdata->byte_cntr_lock);
	if (!drvdata->byte_cntr_present || drvdata->byte_cntr_enable) {
		mutex_unlock(&drvdata->byte_cntr_lock);
		return -EPERM;
	if (sscanf(buf, "%lx", &val) != 1)
	}
	if (sscanf(buf, "%lx", &val) != 1) {
		mutex_unlock(&drvdata->byte_cntr_lock);
		return -EINVAL;
	if ((drvdata->size / 8) < val)
	}
	if ((drvdata->size / 8) < val) {
		mutex_unlock(&drvdata->byte_cntr_lock);
		return -EINVAL;
	if (val && drvdata->size % (val * 8) != 0)
	}
	if (val && drvdata->size % (val * 8) != 0) {
		mutex_unlock(&drvdata->byte_cntr_lock);
		return -EINVAL;
	}

	drvdata->byte_cntr_value = val;
	mutex_unlock(&drvdata->byte_cntr_lock);
	return size;
}
static DEVICE_ATTR(byte_cntr_value, S_IRUGO | S_IWUSR,