Skip to content

Commit

Permalink
coresight-etm: unlock on error paths in mode_store()
Browse files Browse the repository at this point in the history
There are some missing unlocks on the error paths.

Fixes: a939fc5 ('coresight-etm: add CoreSight ETM/PTM driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jan 12, 2015
1 parent fbc4a8a commit 6ad1095
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/coresight/coresight-etm3x.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ static ssize_t mode_store(struct device *dev,
if (drvdata->mode & ETM_MODE_STALL) {
if (!(drvdata->etmccr & ETMCCR_FIFOFULL)) {
dev_warn(drvdata->dev, "stall mode not supported\n");
return -EINVAL;
ret = -EINVAL;
goto err_unlock;
}
drvdata->ctrl |= ETMCR_STALL_MODE;
} else
Expand All @@ -582,7 +583,8 @@ static ssize_t mode_store(struct device *dev,
if (drvdata->mode & ETM_MODE_TIMESTAMP) {
if (!(drvdata->etmccer & ETMCCER_TIMESTAMP)) {
dev_warn(drvdata->dev, "timestamp not supported\n");
return -EINVAL;
ret = -EINVAL;
goto err_unlock;
}
drvdata->ctrl |= ETMCR_TIMESTAMP_EN;
} else
Expand All @@ -595,6 +597,10 @@ static ssize_t mode_store(struct device *dev,
spin_unlock(&drvdata->spinlock);

return size;

err_unlock:
spin_unlock(&drvdata->spinlock);
return ret;
}
static DEVICE_ATTR_RW(mode);

Expand Down

0 comments on commit 6ad1095

Please sign in to comment.