Skip to content

Commit 5653463

Browse files
Shrikanth Hegdemaddy-kerneldev
authored andcommitted
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 Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250505075333.184463-4-sshegde@linux.ibm.com
1 parent 6a21d3c commit 5653463

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

arch/powerpc/kernel/fadump.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,15 +1373,12 @@ static void fadump_free_elfcorehdr_buf(void)
13731373

13741374
static void fadump_invalidate_release_mem(void)
13751375
{
1376-
mutex_lock(&fadump_mutex);
1377-
if (!fw_dump.dump_active) {
1378-
mutex_unlock(&fadump_mutex);
1379-
return;
1376+
scoped_guard(mutex, &fadump_mutex) {
1377+
if (!fw_dump.dump_active)
1378+
return;
1379+
fadump_cleanup();
13801380
}
13811381

1382-
fadump_cleanup();
1383-
mutex_unlock(&fadump_mutex);
1384-
13851382
fadump_free_elfcorehdr_buf();
13861383
fadump_release_memory(fw_dump.boot_mem_top, memblock_end_of_DRAM());
13871384
fadump_free_cpu_notes_buf();

0 commit comments

Comments
 (0)