drivers/gpu/drm/display/drm_hdcp_helper.c:254 drm_hdcp_request_srm() error: uninitialized symbol 'fw'.

From: Dan Carpenter
Date: Mon Sep 19 2022 - 05:20:17 EST


Hi Thomas,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 521a547ced6477c54b4b0cc206000406c221b4d6
commit: 6a99099fe1d6c46cbcd74298eeb386c4b9048f77 drm/display: Move HDCP helpers into display-helper module
config: arc-randconfig-m041-20220919 (https://download.01.org/0day-ci/archive/20220919/202209191450.Y4sMY2Om-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/gpu/drm/display/drm_hdcp_helper.c:254 drm_hdcp_request_srm() error: uninitialized symbol 'fw'.

vim +/fw +254 drivers/gpu/drm/display/drm_hdcp_helper.c

79643fddd6eb2d drivers/gpu/drm/drm_hdcp.c Ramalingam C 2020-02-12 233 static int drm_hdcp_request_srm(struct drm_device *drm_dev,
79643fddd6eb2d drivers/gpu/drm/drm_hdcp.c Ramalingam C 2020-02-12 234 u8 **revoked_ksv_list, u32 *revoked_ksv_cnt)
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 235 {
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 236 char fw_name[36] = "display_hdcp_srm.bin";
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 237 const struct firmware *fw;
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 238 int ret;
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 239
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 240 ret = request_firmware_direct(&fw, (const char *)fw_name,
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 241 drm_dev->dev);
5fe89a6acd668c drivers/gpu/drm/drm_hdcp.c Sean Paul 2020-04-14 242 if (ret < 0) {
5fe89a6acd668c drivers/gpu/drm/drm_hdcp.c Sean Paul 2020-04-14 243 *revoked_ksv_cnt = 0;
5fe89a6acd668c drivers/gpu/drm/drm_hdcp.c Sean Paul 2020-04-14 244 *revoked_ksv_list = NULL;
5fe89a6acd668c drivers/gpu/drm/drm_hdcp.c Sean Paul 2020-04-14 245 ret = 0;
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 246 goto exit;

"fw" isn't initialized so this will crash. Just "return 0;"

5fe89a6acd668c drivers/gpu/drm/drm_hdcp.c Sean Paul 2020-04-14 247 }
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 248
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 249 if (fw->size && fw->data)
79643fddd6eb2d drivers/gpu/drm/drm_hdcp.c Ramalingam C 2020-02-12 250 ret = drm_hdcp_srm_update(fw->data, fw->size, revoked_ksv_list,
79643fddd6eb2d drivers/gpu/drm/drm_hdcp.c Ramalingam C 2020-02-12 251 revoked_ksv_cnt);
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 252
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 253 exit:
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 @254 release_firmware(fw);
79643fddd6eb2d drivers/gpu/drm/drm_hdcp.c Ramalingam C 2020-02-12 255 return ret;
6498bf5800a302 drivers/gpu/drm/drm_hdcp.c Ramalingam C 2019-05-07 256 }

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