[drm-msm:msm-next-staging 61/96] drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:253:22: warning: variable 'mode' is uninitialized when used here

From: kernel test robot
Date: Mon May 02 2022 - 03:02:53 EST


tree: https://gitlab.freedesktop.org/drm/msm.git msm-next-staging
head: f1fc2b87de4719cfa8e193e0746cc524dd9f7472
commit: d7d0e73f7de33a2b9998b607707a3e944ef3b86d [61/96] drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220502/202205021439.HE0yB3Rm-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 09325d36061e42b495d1f4c7e933e260eac260ed)
reproduce (this is a W=1 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
git remote add drm-msm https://gitlab.freedesktop.org/drm/msm.git
git fetch --no-tags drm-msm msm-next-staging
git checkout d7d0e73f7de33a2b9998b607707a3e944ef3b86d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/dma/ti/ drivers/gpu/drm/msm/ drivers/pci/controller/dwc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:253:22: warning: variable 'mode' is uninitialized when used here [-Wuninitialized]
phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
^~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:36:21: note: expanded from macro 'DPU_DEBUG'
DRM_DEBUG(fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
include/drm/drm_print.h:526:32: note: expanded from macro 'DRM_DEBUG'
__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
^~~~~~~~~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:250:37: note: initialize the variable 'mode' to silence this warning
const struct drm_display_mode *mode;
^
= NULL
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:410:6: warning: variable 'refcount' set but not used [-Wunused-but-set-variable]
int refcount;
^
2 warnings generated.


vim +/mode +253 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c

237
238 /**
239 * dpu_encoder_phys_wb_atomic_check - verify and fixup given atomic states
240 * @phys_enc: Pointer to physical encoder
241 * @crtc_state: Pointer to CRTC atomic state
242 * @conn_state: Pointer to connector atomic state
243 */
244 static int dpu_encoder_phys_wb_atomic_check(
245 struct dpu_encoder_phys *phys_enc,
246 struct drm_crtc_state *crtc_state,
247 struct drm_connector_state *conn_state)
248 {
249 struct drm_framebuffer *fb;
250 const struct drm_display_mode *mode;
251
252 DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
> 253 phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
254
255 if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
256 return 0;
257
258 fb = conn_state->writeback_job->fb;
259 mode = &crtc_state->mode;
260
261 if (!conn_state || !conn_state->connector) {
262 DPU_ERROR("invalid connector state\n");
263 return -EINVAL;
264 } else if (conn_state->connector->status !=
265 connector_status_connected) {
266 DPU_ERROR("connector not connected %d\n",
267 conn_state->connector->status);
268 return -EINVAL;
269 }
270
271 DPU_DEBUG("[fb_id:%u][fb:%u,%u]\n", fb->base.id,
272 fb->width, fb->height);
273
274 if (fb->width != mode->hdisplay) {
275 DPU_ERROR("invalid fb w=%d, mode w=%d\n", fb->width,
276 mode->hdisplay);
277 return -EINVAL;
278 } else if (fb->height != mode->vdisplay) {
279 DPU_ERROR("invalid fb h=%d, mode h=%d\n", fb->height,
280 mode->vdisplay);
281 return -EINVAL;
282 } else if (fb->width > DEFAULT_MAX_WRITEBACK_WIDTH) {
283 DPU_ERROR("invalid fb w=%d, maxlinewidth=%u\n",
284 fb->width, DEFAULT_MAX_WRITEBACK_WIDTH);
285 return -EINVAL;
286 }
287
288 return 0;
289 }
290

--
0-DAY CI Kernel Test Service
https://01.org/lkp