From 9e7b32a941fe24d9eff713381a25f21d8116ebc6 Mon Sep 17 00:00:00 2001 From: yao liu Date: Thu, 14 Nov 2019 20:15:21 +0800 Subject: [PATCH] dv: Coverity defect cleanup [1/1] PD#SWPL-16534 Problem: 1.Null-checking vinfo 2.dead_error_condition 3.Err data type Solution: 1.Add Null-checking 2.fix dead_error_condition in dump_setting 3.correct first_reseted data type Verify: U212 Change-Id: I1fd7d4059a231160f38684f92bd36866b6a569ba Signed-off-by: yao liu (cherry picked from commit a0e07f94dbe72dddd6839f418baa554a4d62b4ec) --- .../enhancement/amdolby_vision/amdolby_vision.c | 10 +++++----- drivers/amlogic/media/enhancement/amvecm/amcsc.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c index 1e690cd602aa..b31da72799d2 100644 --- a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c +++ b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c @@ -291,7 +291,7 @@ static int core3_switch; static bool force_set_lut; /*core reg must be set at first time. bit0 is for core2, bit1 is for core3*/ -static bool first_reseted; +static u32 first_reseted; module_param(vtotal_add, uint, 0664); MODULE_PARM_DESC(vtotal_add, "\n vtotal_add\n"); @@ -4145,14 +4145,14 @@ static void dump_setting( READ_VPP_DV_REG( DOLBY_CORE1_REG_START + 50 + i)); - } else if (is_meson_txlx()) { + } else if (is_meson_txlx_stbmode()) { pr_info("core1 swap\n"); - for (i = DOLBY_TV_SWAP_CTRL0; - i <= DOLBY_TV_STATUS1; i++) + for (i = DOLBY_CORE1_CLKGATE_CTRL; + i <= DOLBY_CORE1_DMA_PORT; i++) pr_info("[0x%4x] = 0x%x\n", i, READ_VPP_DV_REG(i)); pr_info("core1 real reg\n"); - for (i = DOLBY_TV_REG_START; + for (i = DOLBY_CORE1_REG_START; i <= DOLBY_CORE1_REG_START + 5; i++) pr_info("[0x%4x] = 0x%x\n", diff --git a/drivers/amlogic/media/enhancement/amvecm/amcsc.c b/drivers/amlogic/media/enhancement/amvecm/amcsc.c index eba35e575dd8..22489af0d51b 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amcsc.c +++ b/drivers/amlogic/media/enhancement/amvecm/amcsc.c @@ -6423,10 +6423,13 @@ static int sink_support_hdr10_plus(const struct vinfo_s *vinfo) bool is_vinfo_available(const struct vinfo_s *vinfo) { - return strcmp(vinfo->name, "invalid") && - strcmp(vinfo->name, "null") && - strcmp(vinfo->name, "576cvbs") && - strcmp(vinfo->name, "470cvbs"); + if (!vinfo) + return false; + else + return strcmp(vinfo->name, "invalid") && + strcmp(vinfo->name, "null") && + strcmp(vinfo->name, "576cvbs") && + strcmp(vinfo->name, "470cvbs"); } EXPORT_SYMBOL(is_vinfo_available); @@ -7153,7 +7156,7 @@ int is_sink_cap_changed( int sink_available; int ret = 0; - if (is_vinfo_available(vinfo)) { + if (vinfo && is_vinfo_available(vinfo)) { hdr_cap = (1 << 0) | (sink_support_dolby_vision(vinfo) << 1) | (sink_support_hdr10_plus(vinfo) << 2) | -- 2.20.1