MLK-16806 - [i.MX8QXP/Malone]: segment fault in gdb environment
authorZhou Peng-B04994 <eagle.zhou@nxp.com>
Mon, 13 Nov 2017 04:07:57 +0000 (12:07 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:46:53 +0000 (15:46 -0500)
function wait_event_interruptible_timeout may return some special value
in gdb debug environment, so we need to add additional check to these
return values, otherwise, interrupt will reported wrongly

Signed-off-by: Zhou Peng-B04994 <eagle.zhou@nxp.com>
drivers/mxc/vpu-malone/Malone_Firmware/PAL/pal.c

index ae7f21e..d75db10 100755 (executable)
@@ -590,6 +590,7 @@ MEDIAIP_FW_STATUS pal_qu_receive ( PAL_QUEUE_ID QuId,
                void         *pMessage )
 {
        u_int32 retval;
+       long ret;
 
        ENTER_FUNC();
        dprintf(LVL_FUNC, "QuId %d\n", QuId);
@@ -597,16 +598,23 @@ MEDIAIP_FW_STATUS pal_qu_receive ( PAL_QUEUE_ID QuId,
                set_current_state(TASK_INTERRUPTIBLE);
                schedule();
        }*/
-       if(!wait_event_interruptible_timeout(irq_wq[QuId],
+       ret = wait_event_interruptible_timeout(irq_wq[QuId],
                        kfifo_len(&irq_fifo[QuId])>=4*sizeof(uint_addr)
                        /* || kthread_should_stop() */,
                        //uTimeoutMs
                        msecs_to_jiffies(uTimeoutMs)
-                       ))
-       {
+                       );
+
+       if (ret == 0) {
                dprintf(LVL_FUNC, "timeout %d ms\n", uTimeoutMs);
                return MEDIAIP_FW_STATUS_TIMEOUT;
+       }       else if (ret == -ERESTARTSYS) {
+               dprintf(LVL_FUNC, "ERROR interrupted by a signal!!\n");
+               return MEDIAIP_FW_STATUS_FAILURE;
+       }       else {
+               dprintf(LVL_FUNC, "%ld returned from wait event\n", ret);
        }
+
        //if(kthread_should_stop())
        //      return MEDIAIP_FW_STATUS_STOPPED;