osd: add ion_alloc failed process
authorpengcheng chen <pengcheng.chen@amlogic.com>
Mon, 11 Jun 2018 08:54:47 +0000 (16:54 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 15 Jun 2018 06:08:57 +0000 (23:08 -0700)
PD#167090: osd: add ion_alloc failed process

Change-Id: I4b6424f3bfaacc57553355a7115be0ed8f7feb34
Signed-off-by: pengcheng chen <pengcheng.chen@amlogic.com>
drivers/amlogic/media/osd/osd_fb.c

index 3a2195b56c9fcf1d145b034bb2667d612c542a8c..d5cc68e19fc8b55c4e137eb723c35df965c26e85 100644 (file)
@@ -1261,7 +1261,8 @@ static int malloc_osd_memory(struct fb_info *info)
                }
        } else {
 #ifdef CONFIG_AMLOGIC_ION
-               pr_info("use ion buffer for fb memory\n");
+               pr_info("use ion buffer for fb memory, fb_index=%d\n",
+                       fb_index);
                if (osd_meson_dev.afbc_type && osd_get_afbc(fb_index)) {
                        pr_info("OSD%d as afbcd mode,afbc_type=%d\n",
                                fb_index, osd_meson_dev.afbc_type);
@@ -1274,6 +1275,11 @@ static int malloc_osd_memory(struct fb_info *info)
                                        0,
                                        (1 << ION_HEAP_TYPE_DMA),
                                        0);
+                               if (IS_ERR(fb_ion_handle[fb_index][j])) {
+                                       osd_log_err("%s: size=%x, FAILED.\n",
+                                       __func__, fb_memsize[fb_index + 1]);
+                                       return -ENOMEM;
+                               }
                                ret = ion_phys(fb_ion_client,
                                        fb_ion_handle[fb_index][j],
                                        (ion_phys_addr_t *)
@@ -1324,6 +1330,11 @@ static int malloc_osd_memory(struct fb_info *info)
                                        0,
                                        (1 << ION_HEAP_TYPE_DMA),
                                        0);
+                       if (IS_ERR(fb_ion_handle[fb_index][0])) {
+                               osd_log_err("%s: size=%x, FAILED.\n",
+                                       __func__, fb_memsize[fb_index + 1]);
+                               return -ENOMEM;
+                       }
                        ret = ion_phys(fb_ion_client,
                                fb_ion_handle[fb_index][0],
                                (ion_phys_addr_t *)