Re: [PATCH v2] scsi: ufs: core: Fix RPMB region size detection for UFS 2.2

From: Bart Van Assche

Date: Thu Feb 05 2026 - 11:10:26 EST


On 2/5/26 12:30 AM, Alexey Charkov wrote:
@@ -5249,6 +5250,20 @@ static void ufshcd_lu_init(struct ufs_hba *hba, struct scsi_device *sdev)
hba->dev_info.rpmb_region_size[1] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION1_SIZE];
hba->dev_info.rpmb_region_size[2] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION2_SIZE];
hba->dev_info.rpmb_region_size[3] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION3_SIZE];

Executing the above code if (hba->dev_info.wspecversion <= 0x0220) is
risky, isn't it?

+ if (hba->dev_info.wspecversion <= 0x0220) {
+ /* These older spec chips have only one RPMB region,
+ * sized between 128 kB minimum and 16 MB maximum.
+ * No per region size fields are provided, so get it
+ * from the logical block count and size fields for
+ * compatibility
+ */

Please follow the Linux kernel coding style for source code comments.
From Documentation/process/coding-style.rst:

The preferred style for long (multi-line) comments is:

.. code-block:: c

/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines.
*/

Thanks,

Bart.