From 867703f5e14b1f0e9b0d0e373bffeff3e3f0be74 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Tue, 5 Jun 2018 09:16:21 +0000 Subject: [PATCH] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait() Add the missing unlock before return from function afu_ioctl_enable_p9_wait() in the error handling case. Fixes: 3d2369b01ba7 ("ocxl: Expose the thread_id needed for wait on POWER9") Signed-off-by: Wei Yongjun Reviewed-by: Alastair D'Silva Signed-off-by: Michael Ellerman --- drivers/misc/ocxl/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 33ae46ce0a8ae..e6a607488f8af 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -139,8 +139,10 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, // Locks both status & tidr mutex_lock(&ctx->status_mutex); if (!ctx->tidr) { - if (set_thread_tidr(current)) + if (set_thread_tidr(current)) { + mutex_unlock(&ctx->status_mutex); return -ENOENT; + } ctx->tidr = current->thread.tidr; } -- 2.39.5