Content-Type: multipart/mixed; boundary="===============7360568240585845959==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v2 1/1] drm/lsdc: add drm driver for loongson display controller Date: Mon, 31 Jan 2022 00:52:31 +0800 Message-ID: <202201310032.kOqILulA-lkp@intel.com> In-Reply-To: <20220130060412.12100-2-15330273260@189.cn> List-Id: --===============7360568240585845959== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Sui, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm/drm-next] [also build test WARNING on v5.17-rc1 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sui-Jingfeng/drm-lsdc-add-= drm-driver-for-loongson-display-controller/20220130-150458 base: git://anongit.freedesktop.org/drm/drm drm-next config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/2022013= 1/202201310032.kOqILulA-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f1c18a= cb07aa40f42b87b70462a6d1ab77a4825c) reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/cdef436d42a3499744f8fd5a1= 613a157dd703819 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sui-Jingfeng/drm-lsdc-add-drm-driv= er-for-loongson-display-controller/20220130-150458 git checkout cdef436d42a3499744f8fd5a1613a157dd703819 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Darm64 SHELL=3D/bin/bash drivers/gpu/drm/lsdc/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/gpu/drm/lsdc/lsdc_plane.c:139:13: warning: variable 'val' is use= d uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] } else if (index =3D=3D 1) { ^~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:147:32: note: uninitialized use occurs= here index, lsdc_pixfmt_to_string(val)); ^~~ include/drm/drm_print.h:429:36: note: expanded from macro 'drm_info' __drm_printk((drm), info,, fmt, ##__VA_ARGS__) ^~~~~~~~~~~ include/drm/drm_print.h:425:48: note: expanded from macro '__drm_printk' dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info' dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), #= #__VA_ARGS__) = ^~~~~~~~~~~ include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk= _index_wrap' _p_func(dev, fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:139:9: note: remove the 'if' if its co= ndition is always true } else if (index =3D=3D 1) { ^~~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:113:9: note: initialize the variable '= val' to silence this warning u32 val; ^ =3D 0 >> drivers/gpu/drm/lsdc/lsdc_plane.c:167:3: warning: variable 'priv_crtc_st= ate' is uninitialized when used here [-Wuninitialized] priv_crtc_state->pix_fmt =3D LSDC_PF_NONE; ^~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:155:41: note: initialize the variable = 'priv_crtc_state' to silence this warning struct lsdc_crtc_state *priv_crtc_state; ^ =3D NULL drivers/gpu/drm/lsdc/lsdc_plane.c:162:12: warning: variable 'val' is use= d uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (index =3D=3D 1) ^~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:165:30: note: uninitialized use occurs= here priv_crtc_state->pix_fmt =3D val & CFG_PIX_FMT_MASK; ^~~ drivers/gpu/drm/lsdc/lsdc_plane.c:162:8: note: remove the 'if' if its co= ndition is always true else if (index =3D=3D 1) ^~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:156:9: note: initialize the variable '= val' to silence this warning u32 val; ^ =3D 0 >> drivers/gpu/drm/lsdc/lsdc_plane.c:201:13: warning: variable 'addr_reg' i= s used uninitialized whenever 'if' condition is false [-Wsometimes-uninitia= lized] } else if (index =3D=3D 1) { ^~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:216:25: note: uninitialized use occurs= here lsdc_reg_write32(ldev, addr_reg, paddr); ^~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:201:9: note: remove the 'if' if its co= ndition is always true } else if (index =3D=3D 1) { ^~~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:179:14: note: initialize the variable = 'addr_reg' to silence this warning u32 addr_reg; ^ =3D 0 >> drivers/gpu/drm/lsdc/lsdc_plane.c:201:13: warning: variable 'cfg_reg' is= used uninitialized whenever 'if' condition is false [-Wsometimes-uninitial= ized] } else if (index =3D=3D 1) { ^~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:222:25: note: uninitialized use occurs= here lsdc_reg_write32(ldev, cfg_reg, val | CFG_PAGE_FLIP_BIT); ^~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:201:9: note: remove the 'if' if its co= ndition is always true } else if (index =3D=3D 1) { ^~~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:180:13: note: initialize the variable = 'cfg_reg' to silence this warning u32 cfg_reg; ^ =3D 0 drivers/gpu/drm/lsdc/lsdc_plane.c:201:13: warning: variable 'val' is use= d uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] } else if (index =3D=3D 1) { ^~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:222:34: note: uninitialized use occurs= here lsdc_reg_write32(ldev, cfg_reg, val | CFG_PAGE_FLIP_BIT); ^~~ drivers/gpu/drm/lsdc/lsdc_plane.c:201:9: note: remove the 'if' if its co= ndition is always true } else if (index =3D=3D 1) { ^~~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:181:9: note: initialize the variable '= val' to silence this warning u32 val; ^ =3D 0 drivers/gpu/drm/lsdc/lsdc_plane.c:583:19: warning: variable 'crtc' set b= ut not used [-Wunused-but-set-variable] struct drm_crtc *crtc; ^ >> drivers/gpu/drm/lsdc/lsdc_plane.c:660:7: warning: variable 'format_count= ' is used uninitialized whenever switch case is taken [-Wsometimes-uninitia= lized] case DRM_PLANE_TYPE_OVERLAY: ^~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:667:21: note: uninitialized use occurs= here formats, format_count, ^~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_plane.c:644:27: note: initialize the variable = 'format_count' to silence this warning unsigned int format_count; ^ =3D 0 8 warnings generated. vim +139 drivers/gpu/drm/lsdc/lsdc_plane.c 104 = 105 = 106 = 107 static void lsdc_update_fb_format(struct lsdc_device *ldev, 108 struct drm_crtc *crtc, 109 const struct drm_format_info *fmt_info) 110 { 111 unsigned int index =3D drm_crtc_index(crtc); 112 u32 fmt; 113 u32 val; 114 = 115 switch (fmt_info->format) { 116 case DRM_FORMAT_RGB565: 117 fmt =3D LSDC_PF_RGB565; 118 break; 119 case DRM_FORMAT_XRGB8888: 120 fmt =3D LSDC_PF_XRGB8888; 121 break; 122 case DRM_FORMAT_ARGB8888: 123 fmt =3D LSDC_PF_XRGB8888; 124 break; 125 default: 126 fmt =3D LSDC_PF_XRGB8888; 127 break; 128 } 129 = 130 drm_dbg_kms(&ldev->drm, "fmt wanted is %s\n", 131 lsdc_pixfmt_to_string(fmt)); 132 = 133 if (index =3D=3D 0) { 134 val =3D lsdc_reg_read32(ldev, LSDC_CRTC0_CFG_REG); 135 val =3D (val & ~CFG_PIX_FMT_MASK) | fmt; 136 lsdc_reg_write32(ldev, LSDC_CRTC0_CFG_REG, val); 137 val =3D lsdc_reg_read32(ldev, LSDC_CRTC0_CFG_REG); 138 = > 139 } else if (index =3D=3D 1) { 140 val =3D lsdc_reg_read32(ldev, LSDC_CRTC1_CFG_REG); 141 val =3D (val & ~CFG_PIX_FMT_MASK) | fmt; 142 lsdc_reg_write32(ldev, LSDC_CRTC1_CFG_REG, val); 143 val =3D lsdc_reg_read32(ldev, LSDC_CRTC1_CFG_REG); 144 } 145 = 146 drm_info(&ldev->drm, "after update fb%d format is %s\n", 147 index, lsdc_pixfmt_to_string(val)); 148 } 149 = 150 = 151 static void lsdc_primary_get_default_format(struct drm_crtc *crtc) 152 { 153 struct lsdc_device *ldev =3D to_lsdc(crtc->dev); 154 unsigned int index =3D drm_crtc_index(crtc); 155 struct lsdc_crtc_state *priv_crtc_state; 156 u32 val; 157 = 158 if (crtc->state) { 159 priv_crtc_state =3D to_lsdc_crtc_state(crtc->state); 160 if (index =3D=3D 0) 161 val =3D lsdc_reg_read32(ldev, LSDC_CRTC0_CFG_REG); 162 else if (index =3D=3D 1) 163 val =3D lsdc_reg_read32(ldev, LSDC_CRTC1_CFG_REG); 164 = 165 priv_crtc_state->pix_fmt =3D val & CFG_PIX_FMT_MASK; 166 } else > 167 priv_crtc_state->pix_fmt =3D LSDC_PF_NONE; 168 = 169 drm_dbg_kms(crtc->dev, "current fb format: %d\n", 170 priv_crtc_state->pix_fmt); 171 } 172 = 173 = 174 static void lsdc_update_fb_start_addr(struct lsdc_device *ldev, 175 struct drm_crtc *crtc, 176 u64 paddr) 177 { 178 unsigned int index =3D drm_crtc_index(crtc); 179 u32 addr_reg; 180 u32 cfg_reg; 181 u32 val; 182 = 183 /* 184 * Find which framebuffer address register should update. 185 * if FB_ADDR0_REG is in using, we write the addr to FB_ADDR1_REG, 186 * if FB_ADDR1_REG is in using, we write the addr to FB_ADDR0_REG 187 */ 188 if (index =3D=3D 0) { 189 /* CRTC0 */ 190 val =3D lsdc_reg_read32(ldev, LSDC_CRTC0_CFG_REG); 191 = 192 cfg_reg =3D LSDC_CRTC0_CFG_REG; 193 = 194 if (val & CFG_FB_IDX_BIT) { 195 addr_reg =3D LSDC_CRTC0_FB_ADDR0_REG; 196 drm_dbg_kms(&ldev->drm, "CRTC0 FB0 will be use\n"); 197 } else { 198 addr_reg =3D LSDC_CRTC0_FB_ADDR1_REG; 199 drm_dbg_kms(&ldev->drm, "CRTC0 FBq will be use\n"); 200 } > 201 } else if (index =3D=3D 1) { 202 /* CRTC1 */ 203 val =3D lsdc_reg_read32(ldev, LSDC_CRTC1_CFG_REG); 204 = 205 cfg_reg =3D LSDC_CRTC1_CFG_REG; 206 = 207 if (val & CFG_FB_IDX_BIT) { 208 addr_reg =3D LSDC_CRTC1_FB_ADDR0_REG; 209 drm_dbg_kms(&ldev->drm, "CRTC1 FB0 will be use\n"); 210 } else { 211 addr_reg =3D LSDC_CRTC1_FB_ADDR1_REG; 212 drm_dbg_kms(&ldev->drm, "CRTC1 FBq will be use\n"); 213 } 214 } 215 = 216 lsdc_reg_write32(ldev, addr_reg, paddr); 217 = 218 /* 219 * Then, we triger the fb switch, the switch of the framebuffer 220 * to be scanout will complete at the next vblank. 221 */ 222 lsdc_reg_write32(ldev, cfg_reg, val | CFG_PAGE_FLIP_BIT); 223 = 224 drm_dbg_kms(&ldev->drm, "crtc%u scantout from 0x%llx\n", index, pad= dr); 225 } 226 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============7360568240585845959==--