* [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
@ 2025-10-31 6:06 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-10-31 5:40 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Bart Van Assche <bvanassche@acm.org>
CC: Avri Altman <avri.altman@sandisk.com>
tree: https://github.com/bvanassche/linux ufs-lrbp-as-priv-data
head: f5ce986a0b77ce2944bf8314554d60eec17968e8
commit: 226979e4eb8a5844be9fb6047a1d042bf2cd72ab [27/28] ufs: core: Move code out of ufshcd_wait_for_dev_cmd()
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-r071-20251031 (https://download.01.org/0day-ci/archive/20251031/202510311328.Is1wMfkq-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
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 <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202510311328.Is1wMfkq-lkp@intel.com/
New smatch warnings:
drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->dev_cmd.lock'.
Old smatch warnings:
drivers/ufs/core/ufshcd.c:6883 ufshcd_err_handler() warn: inconsistent returns '&hba->host_sem'.
drivers/ufs/core/ufshcd.c:9464 ufshcd_setup_clocks() warn: 'clki->clk' from clk_prepare_enable() not released on lines: 9443.
vim +7594 drivers/ufs/core/ufshcd.c
5e0a86eed84607 drivers/scsi/ufs/ufshcd.c Avri Altman 2018-10-07 7513
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7514 /**
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7515 * ufshcd_advanced_rpmb_req_handler - handle advanced RPMB request
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7516 * @hba: per adapter instance
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7517 * @req_upiu: upiu request
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7518 * @rsp_upiu: upiu reply
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7519 * @req_ehs: EHS field which contains Advanced RPMB Request Message
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7520 * @rsp_ehs: EHS field which returns Advanced RPMB Response Message
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7521 * @sg_cnt: The number of sg lists actually used
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7522 * @sg_list: Pointer to SG list when DATA IN/OUT UPIU is required in ARPMB operation
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7523 * @dir: DMA direction
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7524 *
9ee35fd43f94bf drivers/ufs/core/ufshcd.c Bart Van Assche 2025-08-15 7525 * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
9ee35fd43f94bf drivers/ufs/core/ufshcd.c Bart Van Assche 2025-08-15 7526 * < 0 if another error occurred.
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7527 */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7528 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7529 struct utp_upiu_req *rsp_upiu, struct ufs_ehs *req_ehs,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7530 struct ufs_ehs *rsp_ehs, int sg_cnt, struct scatterlist *sg_list,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7531 enum dma_data_direction dir)
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7532 {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7533 const u32 tag = hba->reserved_slot;
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7534 struct scsi_cmnd *cmd = ufshcd_tag_to_cmd(hba, tag);
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7535 struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7536 int err = 0;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7537 int result;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7538 u8 upiu_flags;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7539 u8 *ehs_data;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7540 u16 ehs_len;
996a24b99d63df drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7541 int ehs = (hba->capabilities & MASK_EHSLUTRD_SUPPORTED) ? 2 : 0;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7542
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7543 /* Protects use of hba->reserved_slot. */
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7544 ufshcd_dev_man_lock(hba);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7545
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7546 ufshcd_setup_dev_cmd(hba, cmd, DEV_CMD_TYPE_RPMB, UFS_UPIU_RPMB_WLUN,
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7547 tag);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7548
a33a502d50fddc drivers/ufs/core/ufshcd.c Avri Altman 2024-04-10 7549 ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, ehs);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7550
9f6fec65661381 drivers/ufs/core/ufshcd.c Bean Huo 2023-08-09 7551 /* update the task tag */
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7552 req_upiu->header.task_tag = tag;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7553
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7554 /* copy the UPIU(contains CDB) request as it is */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7555 memcpy(lrbp->ucd_req_ptr, req_upiu, sizeof(*lrbp->ucd_req_ptr));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7556 /* Copy EHS, starting with byte32, immediately after the CDB package */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7557 memcpy(lrbp->ucd_req_ptr + 1, req_ehs, sizeof(*req_ehs));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7558
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7559 if (dir != DMA_NONE && sg_list)
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7560 ufshcd_sgl_to_prdt(hba, lrbp, sg_cnt, sg_list);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7561
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7562 memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7563
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7564 err = ufshcd_issue_dev_cmd(hba, cmd, tag, ADVANCED_RPMB_REQ_TIMEOUT);
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7565 if (err)
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7566 return err;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7567
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7568 err = ufshcd_dev_cmd_completion(hba, lrbp);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7569 if (!err) {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7570 /* Just copy the upiu response as it is */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7571 memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7572 /* Get the response UPIU result */
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7573 result = (lrbp->ucd_rsp_ptr->header.response << 8) |
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7574 lrbp->ucd_rsp_ptr->header.status;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7575
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7576 ehs_len = lrbp->ucd_rsp_ptr->header.ehs_length;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7577 /*
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7578 * Since the bLength in EHS indicates the total size of the EHS Header and EHS Data
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7579 * in 32 Byte units, the value of the bLength Request/Response for Advanced RPMB
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7580 * Message is 02h
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7581 */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7582 if (ehs_len == 2 && rsp_ehs) {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7583 /*
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7584 * ucd_rsp_ptr points to a buffer with a length of 512 bytes
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7585 * (ALIGNED_UPIU_SIZE = 512), and the EHS data just starts from byte32
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7586 */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7587 ehs_data = (u8 *)lrbp->ucd_rsp_ptr + EHS_OFFSET_IN_RESPONSE;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7588 memcpy(rsp_ehs, ehs_data, ehs_len * 32);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7589 }
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7590 }
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7591
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7592 ufshcd_dev_man_unlock(hba);
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7593
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 @7594 return err ? : result;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7595 }
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7596
:::::: The code at line 7594 was first introduced by commit
:::::: 6ff265fc5ef660499e0edc4641647e99eed3f519 scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg
:::::: TO: Bean Huo <beanhuo@micron.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
@ 2025-10-31 6:06 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-10-31 6:06 UTC (permalink / raw)
To: oe-kbuild, Bart Van Assche; +Cc: lkp, oe-kbuild-all, Avri Altman
tree: https://github.com/bvanassche/linux ufs-lrbp-as-priv-data
head: f5ce986a0b77ce2944bf8314554d60eec17968e8
commit: 226979e4eb8a5844be9fb6047a1d042bf2cd72ab [27/28] ufs: core: Move code out of ufshcd_wait_for_dev_cmd()
config: x86_64-randconfig-r071-20251031 (https://download.01.org/0day-ci/archive/20251031/202510311328.Is1wMfkq-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
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/202510311328.Is1wMfkq-lkp@intel.com/
New smatch warnings:
drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->dev_cmd.lock'.
vim +7594 drivers/ufs/core/ufshcd.c
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7528 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7529 struct utp_upiu_req *rsp_upiu, struct ufs_ehs *req_ehs,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7530 struct ufs_ehs *rsp_ehs, int sg_cnt, struct scatterlist *sg_list,
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7531 enum dma_data_direction dir)
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7532 {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7533 const u32 tag = hba->reserved_slot;
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7534 struct scsi_cmnd *cmd = ufshcd_tag_to_cmd(hba, tag);
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7535 struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7536 int err = 0;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7537 int result;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7538 u8 upiu_flags;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7539 u8 *ehs_data;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7540 u16 ehs_len;
996a24b99d63df drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7541 int ehs = (hba->capabilities & MASK_EHSLUTRD_SUPPORTED) ? 2 : 0;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7542
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7543 /* Protects use of hba->reserved_slot. */
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7544 ufshcd_dev_man_lock(hba);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7545
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7546 ufshcd_setup_dev_cmd(hba, cmd, DEV_CMD_TYPE_RPMB, UFS_UPIU_RPMB_WLUN,
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7547 tag);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7548
a33a502d50fddc drivers/ufs/core/ufshcd.c Avri Altman 2024-04-10 7549 ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, ehs);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7550
9f6fec65661381 drivers/ufs/core/ufshcd.c Bean Huo 2023-08-09 7551 /* update the task tag */
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7552 req_upiu->header.task_tag = tag;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7553
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7554 /* copy the UPIU(contains CDB) request as it is */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7555 memcpy(lrbp->ucd_req_ptr, req_upiu, sizeof(*lrbp->ucd_req_ptr));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7556 /* Copy EHS, starting with byte32, immediately after the CDB package */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7557 memcpy(lrbp->ucd_req_ptr + 1, req_ehs, sizeof(*req_ehs));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7558
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7559 if (dir != DMA_NONE && sg_list)
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7560 ufshcd_sgl_to_prdt(hba, lrbp, sg_cnt, sg_list);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7561
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7562 memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7563
dd24291b765afb drivers/ufs/core/ufshcd.c Bart Van Assche 2023-03-06 7564 err = ufshcd_issue_dev_cmd(hba, cmd, tag, ADVANCED_RPMB_REQ_TIMEOUT);
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7565 if (err)
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7566 return err;
ufshcd_dev_man_unlock(hba) before returning.
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7567
226979e4eb8a58 drivers/ufs/core/ufshcd.c Bart Van Assche 2025-09-09 7568 err = ufshcd_dev_cmd_completion(hba, lrbp);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7569 if (!err) {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7570 /* Just copy the upiu response as it is */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7571 memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7572 /* Get the response UPIU result */
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7573 result = (lrbp->ucd_rsp_ptr->header.response << 8) |
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7574 lrbp->ucd_rsp_ptr->header.status;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7575
617bfaa8dd50d6 drivers/ufs/core/ufshcd.c Bart Van Assche 2023-07-27 7576 ehs_len = lrbp->ucd_rsp_ptr->header.ehs_length;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7577 /*
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7578 * Since the bLength in EHS indicates the total size of the EHS Header and EHS Data
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7579 * in 32 Byte units, the value of the bLength Request/Response for Advanced RPMB
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7580 * Message is 02h
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7581 */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7582 if (ehs_len == 2 && rsp_ehs) {
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7583 /*
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7584 * ucd_rsp_ptr points to a buffer with a length of 512 bytes
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7585 * (ALIGNED_UPIU_SIZE = 512), and the EHS data just starts from byte32
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7586 */
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7587 ehs_data = (u8 *)lrbp->ucd_rsp_ptr + EHS_OFFSET_IN_RESPONSE;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7588 memcpy(rsp_ehs, ehs_data, ehs_len * 32);
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7589 }
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7590 }
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7591
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7592 ufshcd_dev_man_unlock(hba);
ddfd7f051f4e14 drivers/ufs/core/ufshcd.c Avri Altman 2024-03-09 7593
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 @7594 return err ? : result;
6ff265fc5ef660 drivers/ufs/core/ufshcd.c Bean Huo 2022-12-01 7595 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
2025-10-31 6:06 ` Dan Carpenter
(?)
@ 2025-10-31 15:57 ` Bart Van Assche
2025-10-31 18:01 ` Dan Carpenter
-1 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2025-10-31 15:57 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all, Avri Altman
On 10/30/25 11:06 PM, Dan Carpenter wrote:
> tree: https://github.com/bvanassche/linux ufs-lrbp-as-priv-data
> head: f5ce986a0b77ce2944bf8314554d60eec17968e8
> commit: 226979e4eb8a5844be9fb6047a1d042bf2cd72ab [27/28] ufs: core: Move code out of ufshcd_wait_for_dev_cmd()
> config: x86_64-randconfig-r071-20251031 (https://download.01.org/0day-ci/archive/20251031/202510311328.Is1wMfkq-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
>
> 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/202510311328.Is1wMfkq-lkp@intel.com/
>
> New smatch warnings:
> drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
> drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->dev_cmd.lock'.
Hi Dan,
Thanks for the report. This report applies to a patch series from July
10 (more than three months ago). I just pushed out the latest version of
this patch series to my github account. Can you please repeat your
analysis for https://github.com/bvanassche/linux ufs-lrbp-as-priv-data?
Thank you,
Bart.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
2025-10-31 15:57 ` Bart Van Assche
@ 2025-10-31 18:01 ` Dan Carpenter
2025-10-31 18:23 ` Bart Van Assche
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-10-31 18:01 UTC (permalink / raw)
To: Bart Van Assche; +Cc: oe-kbuild, lkp, oe-kbuild-all, Avri Altman
On Fri, Oct 31, 2025 at 08:57:25AM -0700, Bart Van Assche wrote:
> On 10/30/25 11:06 PM, Dan Carpenter wrote:
> > tree: https://github.com/bvanassche/linux ufs-lrbp-as-priv-data
> > head: f5ce986a0b77ce2944bf8314554d60eec17968e8
> > commit: 226979e4eb8a5844be9fb6047a1d042bf2cd72ab [27/28] ufs: core: Move code out of ufshcd_wait_for_dev_cmd()
> > config: x86_64-randconfig-r071-20251031 (https://download.01.org/0day-ci/archive/20251031/202510311328.Is1wMfkq-lkp@intel.com/config)
> > compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> >
> > 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/202510311328.Is1wMfkq-lkp@intel.com/
> >
> > New smatch warnings:
> > drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
> > drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->dev_cmd.lock'.
>
> Hi Dan,
>
> Thanks for the report. This report applies to a patch series from July
> 10 (more than three months ago). I just pushed out the latest version of
> this patch series to my github account. Can you please repeat your
> analysis for https://github.com/bvanassche/linux ufs-lrbp-as-priv-data?
>
Hi Bart,
These are from the zero day bot so how they are generated is mysterious.
The zero day bot thought the patch was 3 days old. I think someone did
a merge or something.
I re-ran it on that branch and there were three warnings. The "literal
zero" is a style issue thing so I haven't published that check.
drivers/ufs/core/ufshcd.c:2955 __ufshcd_setup_cmd() warn: variable dereferenced before check 'cmd' (see line 2950)
drivers/ufs/core/ufshcd.c:6849 ufshcd_err_handler() warn: inconsistent returns '&hba->host_sem'.
Locked on : 6696
Unlocked on: 6688,6849
drivers/ufs/core/ufshcd.c:9035 ufshcd_device_init() info: returning a literal zero is cleaner
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
2025-10-31 18:01 ` Dan Carpenter
@ 2025-10-31 18:23 ` Bart Van Assche
2025-11-01 17:10 ` Dan Carpenter
0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2025-10-31 18:23 UTC (permalink / raw)
To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all, Avri Altman
On 10/31/25 11:01 AM, Dan Carpenter wrote:
> These are from the zero day bot so how they are generated is mysterious.
> The zero day bot thought the patch was 3 days old. I think someone did
> a merge or something.
>
> I re-ran it on that branch and there were three warnings. The "literal
> zero" is a style issue thing so I haven't published that check.
>
> drivers/ufs/core/ufshcd.c:2955 __ufshcd_setup_cmd() warn: variable dereferenced before check 'cmd' (see line 2950)
>
> drivers/ufs/core/ufshcd.c:6849 ufshcd_err_handler() warn: inconsistent returns '&hba->host_sem'.
> Locked on : 6696
> Unlocked on: 6688,6849
>
> drivers/ufs/core/ufshcd.c:9035 ufshcd_device_init() info: returning a literal zero is cleaner
Hi Dan,
The inconsistent returns issue for hba->host_sem has been fixed on
Martin Petersen's fixes branch but unfortunately that fix is not yet
present on his for-next branch.
I plan to include a fix for the "variable dereferenced before check
'cmd'" complaint.
Is it expected that I don't see the above reports if I run smatch
myself? This is what I see if I run smatch (commit 2fb2b9093c5d
("sleep_info: The synchronize_srcu() sleeps")):
$ make drivers/ufs/ C=2 CHECK="smatch -p=__kernel__"
CHECK scripts/mod/empty.c
CALL scripts/checksyscalls.sh
CHECK drivers/ufs/core/ufshcd.c
drivers/ufs/core/ufshcd.c:1536 ufshcd_clk_scaling_suspend_work() warn:
ignoring unreachable code.
drivers/ufs/core/ufshcd.c:1551 ufshcd_clk_scaling_resume_work() warn:
ignoring unreachable code.
drivers/ufs/core/ufshcd.c:1616 ufshcd_devfreq_target() warn: ignoring
unreachable code.
drivers/ufs/core/ufshcd.c:1761 ufshcd_suspend_clkscaling() warn:
ignoring unreachable code.
drivers/ufs/core/ufshcd.c:1777 ufshcd_resume_clkscaling() warn: ignoring
unreachable code.
drivers/ufs/core/ufshcd.c:1910 ufshcd_ungate_work() warn: ignoring
unreachable code.
drivers/ufs/core/ufshcd.c:2095 __ufshcd_release() warn: ignoring
unreachable code.
drivers/ufs/core/ufshcd.c:9450 ufshcd_setup_clocks() warn: ignoring
unreachable code.
CHECK drivers/ufs/core/ufs-sysfs.c
CHECK drivers/ufs/core/ufs-mcq.c
CHECK drivers/ufs/core/ufs-debugfs.c
CHECK drivers/ufs/core/ufs_bsg.c
CHECK drivers/ufs/core/ufshcd-crypto.c
CHECK drivers/ufs/core/ufs-fault-injection.c
CHECK drivers/ufs/host/tc-dwc-g210-pci.c
CHECK drivers/ufs/host/ufshcd-dwc.c
CHECK drivers/ufs/host/tc-dwc-g210.c
CHECK drivers/ufs/host/ufshcd-pci.c
drivers/ufs/host/ufshcd-pci.c:45 __intel_dsm_supported() warn: always
true condition '(fn >= 0) => (0-u32max >= 0)'
CHECK drivers/ufs/host/ufshcd-pltfrm.c
Thanks!
Bart.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock'.
2025-10-31 18:23 ` Bart Van Assche
@ 2025-11-01 17:10 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-11-01 17:10 UTC (permalink / raw)
To: Bart Van Assche; +Cc: oe-kbuild, lkp, oe-kbuild-all, Avri Altman
On Fri, Oct 31, 2025 at 11:23:39AM -0700, Bart Van Assche wrote:
> On 10/31/25 11:01 AM, Dan Carpenter wrote:
> > These are from the zero day bot so how they are generated is mysterious.
> > The zero day bot thought the patch was 3 days old. I think someone did
> > a merge or something.
> >
> > I re-ran it on that branch and there were three warnings. The "literal
> > zero" is a style issue thing so I haven't published that check.
> >
> > drivers/ufs/core/ufshcd.c:2955 __ufshcd_setup_cmd() warn: variable dereferenced before check 'cmd' (see line 2950)
> >
> > drivers/ufs/core/ufshcd.c:6849 ufshcd_err_handler() warn: inconsistent returns '&hba->host_sem'.
> > Locked on : 6696
> > Unlocked on: 6688,6849
> >
> > drivers/ufs/core/ufshcd.c:9035 ufshcd_device_init() info: returning a literal zero is cleaner
>
> Hi Dan,
>
> The inconsistent returns issue for hba->host_sem has been fixed on Martin
> Petersen's fixes branch but unfortunately that fix is not yet
> present on his for-next branch.
>
> I plan to include a fix for the "variable dereferenced before check
> 'cmd'" complaint.
>
> Is it expected that I don't see the above reports if I run smatch
> myself? This is what I see if I run smatch (commit 2fb2b9093c5d
> ("sleep_info: The synchronize_srcu() sleeps")):
>
Yes. The dereference happens inside a function so you need to have built
the cross function database to see that one.
It's not hard, but it takes a while. smatch_scripts/build_kernel_data.sh
You might need to rebuild it twice to see the warning...
https://staticthinking.wordpress.com/2023/05/02/the-cross-function-db/
> $ make drivers/ufs/ C=2 CHECK="smatch -p=__kernel__"
> CHECK scripts/mod/empty.c
> CALL scripts/checksyscalls.sh
> CHECK drivers/ufs/core/ufshcd.c
> drivers/ufs/core/ufshcd.c:1536 ufshcd_clk_scaling_suspend_work() warn:
> ignoring unreachable code.
This isn't supposed to show up. It's seems to not be parsing scoped
guard correctly... I can't reproduce it. I think I'm on the same kernel
and Smatch release that you are on but I still can't reproduce it. It's
not something I have seen from the kbuild-bot either.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-01 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 5:40 [bvanassche:ufs-lrbp-as-priv-data 27/28] drivers/ufs/core/ufshcd.c:7594 ufshcd_advanced_rpmb_req_handler() warn: inconsistent returns '&hba->clk_scaling_lock' kernel test robot
2025-10-31 6:06 ` Dan Carpenter
2025-10-31 15:57 ` Bart Van Assche
2025-10-31 18:01 ` Dan Carpenter
2025-10-31 18:23 ` Bart Van Assche
2025-11-01 17:10 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.