From 377ce8809799be06bfa66415eef28666c2dd2600 Mon Sep 17 00:00:00 2001 From: Nanxin Qin Date: Mon, 26 Feb 2018 17:36:32 +0800 Subject: [PATCH] vh265: fixes an issue that using semaphore could cause crash. PD#161077: fixes an issue that using semaphore could cause crash Change-Id: I5ea95042a92030e298bcc026aeed48f436cf739e Signed-off-by: Nanxin Qin --- .../frame_provider/decoder/h265/vh265.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c index 95ac982ff355..0fe1a772b40f 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c @@ -8501,7 +8501,8 @@ static int h265_task_handle(void *data) hevc_print(hevc, 0, "uninit list\n"); hevc->uninit_list = 0; #ifdef USE_UNINIT_SEMA - up(&hevc->h265_uninit_done_sema); + if (use_cma) + up(&hevc->h265_uninit_done_sema); #endif } @@ -8906,12 +8907,11 @@ static s32 vh265_init(struct hevc_state_s *hevc) hevc->stat |= STAT_TIMER_ARM; if (use_cma) { +#ifdef USE_UNINIT_SEMA + sema_init(&hevc->h265_uninit_done_sema, 0); +#endif if (h265_task == NULL) { sema_init(&h265_sema, 1); -#ifdef USE_UNINIT_SEMA - sema_init( - &hevc->h265_uninit_done_sema, 0); -#endif h265_task = kthread_run(h265_task_handle, hevc, "kthread_h265"); @@ -9229,7 +9229,8 @@ static void vh265_work(struct work_struct *work) hevc_print(hevc, 0, "uninit list\n"); hevc->uninit_list = 0; #ifdef USE_UNINIT_SEMA - up(&hevc->h265_uninit_done_sema); + if (use_cma) + up(&hevc->h265_uninit_done_sema); #endif return; }