diff mbox series

[RESEND,1/4] scsi:ufs:remove sanity check

Message ID 20221102053058.21021-2-lijiaming3@xiaomi.corp-partner.google.com
State New
Headers show
Series Implement File-Based optimization functionality | expand

Commit Message

Jiaming Li Nov. 2, 2022, 5:30 a.m. UTC
From: lijiaming3 <lijiaming3@xiaomi.com>

UFS descriptors assumed to have a 2 bytes header:
 - Offset 0 - descriptor size
 - Offset 1 - descriptor id
However, the ufs spec does not mandates this, and as a matter of
fact, QUERY_DESC_DESC_TYPE_OFFSET is not being used anymore now.
And future descriptors no longer follow this assumption. So
remove this as preparation of introducing the FBO descriptor.

Signed-off-by: lijiaming3 <lijiaming3@xiaomi.com>
---
 drivers/ufs/core/ufshcd.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Avri Altman Nov. 2, 2022, 7:23 a.m. UTC | #1
> From: lijiaming3 <lijiaming3@xiaomi.com>
> 
> UFS descriptors assumed to have a 2 bytes header:
>  - Offset 0 - descriptor size
>  - Offset 1 - descriptor id
> However, the ufs spec does not mandates this, and as a matter of fact,
> QUERY_DESC_DESC_TYPE_OFFSET is not being used anymore now.
So maybe remove it from ufs.h as well?

> And future descriptors no longer follow this assumption. So remove this as
> preparation of introducing the FBO descriptor.
> 
> Signed-off-by: lijiaming3 <lijiaming3@xiaomi.com>
other than the nit above:
Reviewed-by: Avri Altman <avri.altman@wdc.com>

> ---
>  drivers/ufs/core/ufshcd.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> b1f59a5fe632..4bc5b8563a62 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3458,14 +3458,6 @@ int ufshcd_read_desc_param(struct ufs_hba
> *hba,
>                 goto out;
>         }
> 
> -       /* Sanity check */
> -       if (desc_buf[QUERY_DESC_DESC_TYPE_OFFSET] != desc_id) {
> -               dev_err(hba->dev, "%s: invalid desc_id %d in descriptor header\n",
> -                       __func__, desc_buf[QUERY_DESC_DESC_TYPE_OFFSET]);
> -               ret = -EINVAL;
> -               goto out;
> -       }
> -
>         /* Update descriptor length */
>         buff_len = desc_buf[QUERY_DESC_LENGTH_OFFSET];
>         ufshcd_update_desc_length(hba, desc_id, desc_index, buff_len);
> --
> 2.38.1
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index b1f59a5fe632..4bc5b8563a62 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3458,14 +3458,6 @@  int ufshcd_read_desc_param(struct ufs_hba *hba,
 		goto out;
 	}
 
-	/* Sanity check */
-	if (desc_buf[QUERY_DESC_DESC_TYPE_OFFSET] != desc_id) {
-		dev_err(hba->dev, "%s: invalid desc_id %d in descriptor header\n",
-			__func__, desc_buf[QUERY_DESC_DESC_TYPE_OFFSET]);
-		ret = -EINVAL;
-		goto out;
-	}
-
 	/* Update descriptor length */
 	buff_len = desc_buf[QUERY_DESC_LENGTH_OFFSET];
 	ufshcd_update_desc_length(hba, desc_id, desc_index, buff_len);