ARC: stack unwinder to bail if PC is not kernel mode
authorVineet Gupta <vgupta@synopsys.com>
Fri, 10 Apr 2015 08:36:40 +0000 (14:06 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Fri, 19 Jun 2015 12:39:29 +0000 (18:09 +0530)
Currently, it doesn't invoke the callback but continues to unwind

Also while at it - simplify the code a bit

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/kernel/stacktrace.c

index 92320d6f737cf5149d0968f5da3cd73a47af9848..001de4ce711eae2b095451a52f68e77db3d81ef4 100644 (file)
@@ -122,19 +122,17 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
        while (1) {
                address = UNW_PC(&frame_info);
 
-               if (address && __kernel_text_address(address)) {
-                       if (consumer_fn(address, arg) == -1)
-                               break;
-               }
+               if (!address || !__kernel_text_address(address))
+                       break;
 
-               ret = arc_unwind(&frame_info);
+               if (consumer_fn(address, arg) == -1)
+                       break;
 
-               if (ret == 0) {
-                       frame_info.regs.r63 = frame_info.regs.r31;
-                       continue;
-               } else {
+               ret = arc_unwind(&frame_info);
+               if (ret)
                        break;
-               }
+
+               frame_info.regs.r63 = frame_info.regs.r31;
        }
 
        return address;         /* return the last address it saw */