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/[email protected]/T/#u Reviewed-by: Srikar Dronamraju <[email protected]> Signed-off-by: Shrikanth Hegde <[email protected]> Tested-by: Venkat Rao Bagalkote <[email protected]> Reviewed-by: Sourabh Jain <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 6a21d3c commit 5653463

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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)