[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250314114502.2083434-4-sshegde@linux.ibm.com>
Date: Fri, 14 Mar 2025 17:14:59 +0530
From: Shrikanth Hegde <sshegde@...ux.ibm.com>
To: maddy@...ux.ibm.com, linuxppc-dev@...ts.ozlabs.org
Cc: sshegde@...ux.ibm.com, npiggin@...il.com, christophe.leroy@...roup.eu,
mpe@...erman.id.au, peterz@...radead.org, fbarrat@...ux.ibm.com,
ajd@...ux.ibm.com, mahesh@...ux.ibm.com, oohall@...il.com,
hbathini@...ux.ibm.com, dhowells@...hat.com, haren@...ux.ibm.com,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 3/6] powerpc: fadump: use lock guard for mutex
use scoped_guard for scope based resource management of mutex.
This would make the code simpler and easier to maintain.
More details on lock guards can be found at
https://lore.kernel.org/all/20230612093537.614161713@infradead.org/T/#u
Signed-off-by: Shrikanth Hegde <sshegde@...ux.ibm.com>
---
arch/powerpc/kernel/fadump.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 4b371c738213..fc6c5275811e 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1374,15 +1374,12 @@ static void fadump_free_elfcorehdr_buf(void)
static void fadump_invalidate_release_mem(void)
{
- mutex_lock(&fadump_mutex);
- if (!fw_dump.dump_active) {
- mutex_unlock(&fadump_mutex);
- return;
+ scoped_guard(mutex, &fadump_mutex) {
+ if (!fw_dump.dump_active)
+ return;
+ fadump_cleanup();
}
- fadump_cleanup();
- mutex_unlock(&fadump_mutex);
-
fadump_free_elfcorehdr_buf();
fadump_release_memory(fw_dump.boot_mem_top, memblock_end_of_DRAM());
fadump_free_cpu_notes_buf();
--
2.39.3
Powered by blists - more mailing lists