dv: Coverity defect cleanup [1/1]
authoryao liu <yao.liu@amlogic.com>
Thu, 14 Nov 2019 12:15:21 +0000 (20:15 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 17 Dec 2019 04:34:16 +0000 (21:34 -0700)
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 <yao.liu@amlogic.com>
(cherry picked from commit a0e07f94dbe72dddd6839f418baa554a4d62b4ec)

drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c
drivers/amlogic/media/enhancement/amvecm/amcsc.c

index 1e690cd602aabd506d5bed58349d4f9fcd1b5003..b31da72799d27d7cf3092931d128d858ac244088 100644 (file)
@@ -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",
index eba35e575dd8a4d4a47da7c59b61c82825947d87..22489af0d51b346d1a94e5643082ca70c538dc27 100644 (file)
@@ -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) |