Skip to content

Commit 29cdd4e

Browse files
kuba-moojoergroedel
authored andcommitted
dma-debug: release free_entries_lock before saving stack trace
Saving stack trace can take a while and once the entry is allocated free_entries_lock is no longer needed. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent 0034102 commit 29cdd4e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎lib/dma-debug.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,29 +430,29 @@ static struct dma_debug_entry *__dma_entry_alloc(void)
430430
*/
431431
static struct dma_debug_entry *dma_entry_alloc(void)
432432
{
433-
struct dma_debug_entry *entry = NULL;
433+
struct dma_debug_entry *entry;
434434
unsigned long flags;
435435

436436
spin_lock_irqsave(&free_entries_lock, flags);
437437

438438
if (list_empty(&free_entries)) {
439439
pr_err("DMA-API: debugging out of memory - disabling\n");
440440
global_disable = true;
441-
goto out;
441+
spin_unlock_irqrestore(&free_entries_lock, flags);
442+
return NULL;
442443
}
443444

444445
entry = __dma_entry_alloc();
445446

447+
spin_unlock_irqrestore(&free_entries_lock, flags);
448+
446449
#ifdef CONFIG_STACKTRACE
447450
entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
448451
entry->stacktrace.entries = entry->st_entries;
449452
entry->stacktrace.skip = 2;
450453
save_stack_trace(&entry->stacktrace);
451454
#endif
452455

453-
out:
454-
spin_unlock_irqrestore(&free_entries_lock, flags);
455-
456456
return entry;
457457
}
458458

0 commit comments

Comments
 (0)