From 596cc1ea4a9b2faa0b1999ab361af6fb922d4d0a Mon Sep 17 00:00:00 2001 From: Xihai Zhu Date: Wed, 7 Aug 2019 00:00:01 -0400 Subject: [PATCH] amvecm: fix LC illegal mem access issue [1/1] 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 --- drivers/amlogic/media/enhancement/amvecm/local_contrast.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amvecm/local_contrast.c b/drivers/amlogic/media/enhancement/amvecm/local_contrast.c index f1b3cea..f5897cb 100644 --- a/drivers/amlogic/media/enhancement/amvecm/local_contrast.c +++ b/drivers/amlogic/media/enhancement/amvecm/local_contrast.c @@ -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; } -- 2.7.4