Commit 6ad10959 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

coresight-etm: unlock on error paths in mode_store()

There are some missing unlocks on the error paths.

Fixes: a939fc5a ('coresight-etm: add CoreSight ETM/PTM driver')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fbc4a8a8
...@@ -573,7 +573,8 @@ static ssize_t mode_store(struct device *dev, ...@@ -573,7 +573,8 @@ static ssize_t mode_store(struct device *dev,
if (drvdata->mode & ETM_MODE_STALL) { if (drvdata->mode & ETM_MODE_STALL) {
if (!(drvdata->etmccr & ETMCCR_FIFOFULL)) { if (!(drvdata->etmccr & ETMCCR_FIFOFULL)) {
dev_warn(drvdata->dev, "stall mode not supported\n"); dev_warn(drvdata->dev, "stall mode not supported\n");
return -EINVAL; ret = -EINVAL;
goto err_unlock;
} }
drvdata->ctrl |= ETMCR_STALL_MODE; drvdata->ctrl |= ETMCR_STALL_MODE;
} else } else
...@@ -582,7 +583,8 @@ static ssize_t mode_store(struct device *dev, ...@@ -582,7 +583,8 @@ static ssize_t mode_store(struct device *dev,
if (drvdata->mode & ETM_MODE_TIMESTAMP) { if (drvdata->mode & ETM_MODE_TIMESTAMP) {
if (!(drvdata->etmccer & ETMCCER_TIMESTAMP)) { if (!(drvdata->etmccer & ETMCCER_TIMESTAMP)) {
dev_warn(drvdata->dev, "timestamp not supported\n"); dev_warn(drvdata->dev, "timestamp not supported\n");
return -EINVAL; ret = -EINVAL;
goto err_unlock;
} }
drvdata->ctrl |= ETMCR_TIMESTAMP_EN; drvdata->ctrl |= ETMCR_TIMESTAMP_EN;
} else } else
...@@ -595,6 +597,10 @@ static ssize_t mode_store(struct device *dev, ...@@ -595,6 +597,10 @@ static ssize_t mode_store(struct device *dev,
spin_unlock(&drvdata->spinlock); spin_unlock(&drvdata->spinlock);
return size; return size;
err_unlock:
spin_unlock(&drvdata->spinlock);
return ret;
} }
static DEVICE_ATTR_RW(mode); static DEVICE_ATTR_RW(mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment