Re: [PATCH] drm/stm: ltdc: unify log system
From: Dan Carpenter <hidden>
Date: 2025-08-25 07:35:23
Also in:
dri-devel, lkml, oe-kbuild, oe-kbuild-all
Hi Raphael, kernel test robot noticed the following build warnings: https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/drm-stm-ltdc-unify-log-system/20250821-210930 base: https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next patch link: https://lore.kernel.org/r/20250821130356.883553-1-raphael.gallais-pou%40foss.st.com patch subject: [PATCH] drm/stm: ltdc: unify log system config: arm-randconfig-r072-20250824 (https://download.01.org/0day-ci/archive/20250825/202508250637.nLxtkS26-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Reported-by: Dan Carpenter [off-list ref] | Closes: https://lore.kernel.org/r/202508250637.nLxtkS26-lkp@intel.com/ (local) New smatch warnings: drivers/gpu/drm/stm/ltdc.c:1150 ltdc_crtc_set_crc_source() warn: variable dereferenced before check 'crtc' (see line 1148) drivers/gpu/drm/stm/ltdc.c:1174 ltdc_crtc_verify_crc_source() warn: variable dereferenced before check 'crtc' (see line 1172) vim +/crtc +1150 drivers/gpu/drm/stm/ltdc.c 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1143 static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1144 { 898a9e3f56db98 Raphael Gallais-Pou 2023-05-15 1145 struct ltdc_device *ldev; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1146 int ret; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1147 fa2b2390600532 Raphael Gallais-Pou 2025-08-21 @1148 drm_dbg_driver(crtc->dev, "\n"); ^^^^^^^^^ Dereference. A lot of the time people would suggest to delete these types of printks and use ftrace instead. 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1149 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 @1150 if (!crtc) ^^^^^ Checked too late. 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1151 return -ENODEV; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1152 898a9e3f56db98 Raphael Gallais-Pou 2023-05-15 1153 ldev = crtc_to_ltdc(crtc); 898a9e3f56db98 Raphael Gallais-Pou 2023-05-15 1154 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1155 if (source && strcmp(source, "auto") == 0) { 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1156 ldev->crc_active = true; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1157 ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1158 } else if (!source) { 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1159 ldev->crc_active = false; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1160 ret = regmap_clear_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1161 } else { 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1162 ret = -EINVAL; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1163 } 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1164 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1165 ldev->crc_skip_count = 0; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1166 return ret; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1167 } 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1168 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1169 static int ltdc_crtc_verify_crc_source(struct drm_crtc *crtc, 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1170 const char *source, size_t *values_cnt) 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1171 { fa2b2390600532 Raphael Gallais-Pou 2025-08-21 @1172 drm_dbg_driver(crtc->dev, "\n"); ^^^^^^^^ Dereference 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1173 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 @1174 if (!crtc) ^^^^^ Too late. 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1175 return -ENODEV; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1176 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1177 if (source && strcmp(source, "auto") != 0) { fa2b2390600532 Raphael Gallais-Pou 2025-08-21 1178 drm_dbg_driver(crtc->dev, "Unknown CRC source %s for %s\n", 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1179 source, crtc->name); 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1180 return -EINVAL; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1181 } 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1182 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1183 *values_cnt = 1; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1184 return 0; 79b44684a14e36 Raphael Gallais-Pou 2022-02-11 1185 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki