summaryrefslogtreecommitdiff
path: root/drivers/fsi
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-07-23 16:27:21 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-07-23 16:27:32 +1000
commit4fcdc2d1b0c615331eb68b50da8e499223fac724 (patch)
tree323726e9c52c61950fdd64c1e2bb461f983b3b6e /drivers/fsi
parent6a794a27daca9c5a39de13c03b0748bb2d4a7a70 (diff)
fsi: sbefifo: Fix inconsistent use of ffdc mutex
Some of the exit path missed the unlock. Move the mutex to an outer function to avoid the problem completely Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/fsi')
-rw-r--r--drivers/fsi/fsi-sbefifo.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 6b31cc24fb0d..33a5d9a43a07 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -136,16 +136,14 @@ struct sbefifo_user {
static DEFINE_IDA(sbefifo_ida);
static DEFINE_MUTEX(sbefifo_ffdc_mutex);
-
-static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
- size_t ffdc_sz, bool internal)
+static void __sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
+ size_t ffdc_sz, bool internal)
{
int pack = 0;
#define FFDC_LSIZE 60
static char ffdc_line[FFDC_LSIZE];
char *p = ffdc_line;
- mutex_lock(&sbefifo_ffdc_mutex);
while (ffdc_sz) {
u32 w0, w1, w2, i;
if (ffdc_sz < 3) {
@@ -194,6 +192,13 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
}
dev_warn(dev, "+-------------------------------------------+\n");
}
+}
+
+static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
+ size_t ffdc_sz, bool internal)
+{
+ mutex_lock(&sbefifo_ffdc_mutex);
+ __sbefifo_dump_ffdc(dev, ffdc, ffdc_sz, internal);
mutex_unlock(&sbefifo_ffdc_mutex);
}