Re: [PATCH v2 2/3] scsi: ufs: core: Add ufshcd_wb_buf_resize function to enable WB buffer resize

Dan Carpenter
2023-09-11T08:21:20Z

Hi Lu,

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/Lu-Hongfei/scsi-ufs-core-add-wb-buffer-resize-related-attr_idn/20230908-182656
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20230908102113.547-3-luhongfei%40vivo.com
patch subject: [PATCH v2 2/3] scsi: ufs: core: Add ufshcd_wb_buf_resize function to enable WB buffer resize
config: i386-randconfig-141-20230909 (https://download.01.org/0day-ci/archive/20230909/202309091536.TRk3mftu-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230909/202309091536.TRk3mftu-lkp@intel.com/reproduce)

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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202309091536.TRk3mftu-lkp@intel.com/

New smatch warnings:
drivers/ufs/core/ufshcd.c:6067 ufshcd_wb_buf_resize() error: uninitialized symbol 'ret'.

Old smatch warnings:
drivers/ufs/core/ufshcd.c:5353 ufshcd_uic_cmd_compl() error: we previously assumed 'hba->active_uic_cmd' could be null (see line 5341)

vim +/ret +6067 drivers/ufs/core/ufshcd.c

7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6049 int ufshcd_wb_buf_resize(struct ufs_hba *hba, u32 resize_op)
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6050 {
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6051 int ret;
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6052 u8 index;
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6053
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6054 ufshcd_scsi_block_requests(hba);
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6055 if (ufshcd_wait_for_doorbell_clr(hba, 1 * USEC_PER_SEC))
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6056 goto out;

ret is unitialized.

7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6057
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6058 index = ufshcd_wb_get_query_index(hba);
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6059 ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6060 QUERY_ATTR_IDN_WB_BUF_RESIZE_EN, index, 0, &resize_op);
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6061 if (ret)
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6062 dev_err(hba->dev,
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6063 "%s: Enable WB buf resize operation failed %d\n",
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6064 __func__, ret);
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6065 out:
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6066 ufshcd_scsi_unblock_requests(hba);
7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 @6067 return ret;
^^^

7b70b34c503067 drivers/ufs/core/ufshcd.c Lu Hongfei 2023-09-08 6068 }

--
0-DAY CI Kernel Test Service