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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 6a794a27
...@@ -136,8 +136,7 @@ struct sbefifo_user { ...@@ -136,8 +136,7 @@ struct sbefifo_user {
static DEFINE_IDA(sbefifo_ida); static DEFINE_IDA(sbefifo_ida);
static DEFINE_MUTEX(sbefifo_ffdc_mutex); static DEFINE_MUTEX(sbefifo_ffdc_mutex);
static void __sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
size_t ffdc_sz, bool internal) size_t ffdc_sz, bool internal)
{ {
int pack = 0; int pack = 0;
...@@ -145,7 +144,6 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, ...@@ -145,7 +144,6 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
static char ffdc_line[FFDC_LSIZE]; static char ffdc_line[FFDC_LSIZE];
char *p = ffdc_line; char *p = ffdc_line;
mutex_lock(&sbefifo_ffdc_mutex);
while (ffdc_sz) { while (ffdc_sz) {
u32 w0, w1, w2, i; u32 w0, w1, w2, i;
if (ffdc_sz < 3) { if (ffdc_sz < 3) {
...@@ -194,6 +192,13 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, ...@@ -194,6 +192,13 @@ static void sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc,
} }
dev_warn(dev, "+-------------------------------------------+\n"); 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); mutex_unlock(&sbefifo_ffdc_mutex);
} }
......
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