ionvideo: fix a crash in ionvideo_thread_tick
authorjintao xu <jintao.xu@amlogic.com>
Mon, 27 Aug 2018 07:22:49 +0000 (15:22 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 3 Sep 2018 10:54:32 +0000 (03:54 -0700)
PD#171379:

Change-Id: I868dd27b8ada3e9bb199e1d6b4325151a568dbf7
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
drivers/amlogic/media/video_processor/ionvideo/ionvideo.c
drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c

index 0254574..1db29db 100644 (file)
@@ -382,6 +382,9 @@ static void ionvideo_thread_tick(struct ionvideo_dev *dev)
        if (dev->active_state == ION_INACTIVE)
                return;
 
+       if (dev->receiver_register == 0)
+               return;
+
        dev->wait_ge2d_timeout = false;
        vf = vf_peek(dev->vf_receiver_name);
        if (!vf) {
@@ -961,15 +964,14 @@ static int video_receiver_event_fun(int type, void *data, void *private_data)
                }
 
                /*tsync_avevent(VIDEO_STOP, 0);*/
-               IONVID_DBG("unreg:ionvideo\n");
+               pr_info("unreg:ionvideo\n");
        } else if (type == VFRAME_EVENT_PROVIDER_REG) {
-               dev->receiver_register = 1;
                dev->is_omx_video_started = 1;
                dev->ppmgr2_dev.interlaced_num = 0;
                dev->active_state = ION_ACTIVE;
                init_completion(&dev->inactive_done);
-
-               IONVID_DBG("reg:ionvideo\n");
+               dev->receiver_register = 1;
+               pr_info("reg:ionvideo\n");
        } else if (type == VFRAME_EVENT_PROVIDER_QUREY_STATE) {
                if (dev->vf_wait_cnt > 1)
                        return RECEIVER_INACTIVE;
index e74d486..9ab7de9 100644 (file)
@@ -481,6 +481,11 @@ int ppmgr2_process(struct vframe_s *vf, struct ppmgr2_device *ppd, int index)
        int angle = (ppd->angle + src_vf->orientation) % 4;
        int dst_canvas_id = 0;
 
+       if (ppd->phy_addr[index] == NULL) {
+               ppmgr2_printk(1, "NULL physical address!\n");
+               return -1;
+       }
+
        if (src_vf->type & VIDTYPE_INTERLACE) {
                if ((ppd->bottom_first && src_vf->type & 0x2)
                        || (ppd->bottom_first == 0