Skip to content

Commit a5a242d

Browse files
vegardIngo Molnar
authored and
Ingo Molnar
committed
stacktrace: print_stack_trace() cleanup
- shorter code and better atomicity with regards to printk(). (It's been tested with the backtrace self-test code on i386 and x86_64.) Cc: Arjan van de Ven <[email protected]> Signed-off-by: Vegard Nossum <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 886dd58 commit a5a242d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

kernel/stacktrace.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@
1111

1212
void print_stack_trace(struct stack_trace *trace, int spaces)
1313
{
14-
int i, j;
14+
int i;
1515

1616
if (WARN_ON(!trace->entries))
1717
return;
1818

1919
for (i = 0; i < trace->nr_entries; i++) {
20-
unsigned long ip = trace->entries[i];
21-
22-
for (j = 0; j < spaces + 1; j++)
23-
printk(" ");
24-
print_ip_sym(ip);
20+
printk("%*c", 1 + spaces, ' ');
21+
print_ip_sym(trace->entries[i]);
2522
}
2623
}
2724

0 commit comments

Comments
 (0)