amvecm: fix LC illegal mem access issue [1/1]
authorXihai Zhu <xihai.zhu@amlogic.com>
Wed, 7 Aug 2019 04:00:01 +0000 (00:00 -0400)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 8 Aug 2019 02:34:36 +0000 (19:34 -0700)
PD#SWPL-12386

Problem:
LC access illegal mem while system shutdown

Solution:
avoid such accessing after mem is freed

Verify:
tl1

Change-Id: Ia817c5054ce863403ea4301c1728e16c4c033986
Signed-off-by: Xihai Zhu <xihai.zhu@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/local_contrast.c

index f1b3cea..f5897cb 100644 (file)
@@ -1493,14 +1493,16 @@ void lc_process(struct vframe_s *vf,
        else
                bitdepth = 12;
 
-       if (!lc_en) {
-               lc_disable();
-               return;
-       }
        if (!lc_malloc_ok) {
                pr_amlc_dbg("%s: lc malloc fail", __func__);
                return;
        }
+
+       if (!lc_en) {
+               lc_disable();
+               return;
+       }
+
        if (vf == NULL) {
                if (lc_flag == 0xff) {
                        lc_disable();
@@ -1539,4 +1541,5 @@ void lc_free(void)
        kfree(curve_nodes_cur);
        kfree(curve_nodes_pre);
        kfree(lc_hist);
+       lc_malloc_ok = 0;
 }