diff mbox series

[v2] scsi: ufs: core: Fix error return with query response

Message ID 20250118023808.24726-1-sh043.lee@samsung.com
State New
Headers show
Series [v2] scsi: ufs: core: Fix error return with query response | expand

Commit Message

Seunghui Lee Jan. 18, 2025, 2:38 a.m. UTC
There is currently no mechanism to return error from query responses.
Return the error and print the corresponding error message with it.

Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
---
Changes to v1:
- modify the error message with response in UPIU(Bean Huo's suggestion)
---
 drivers/ufs/core/ufshcd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Bean Huo Jan. 21, 2025, 1:10 p.m. UTC | #1
On Sat, 2025-01-18 at 11:38 +0900, Seunghui Lee wrote:
> There is currently no mechanism to return error from query responses.
> Return the error and print the corresponding error message with it.
> 
> Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>

you need cc to all of UFS stack developers, then your patch could get a
quick review, not only just sent to scsi maillist:


Reviewed-by: Bean Huo <beanhuo@micron.com>
Bart Van Assche Jan. 21, 2025, 6:23 p.m. UTC | #2
On 1/17/25 6:38 PM, Seunghui Lee wrote:
> There is currently no mechanism to return error from query responses.
> Return the error and print the corresponding error message with it.
> 
> Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
> ---
> Changes to v1:
> - modify the error message with response in UPIU(Bean Huo's suggestion)
> ---
>   drivers/ufs/core/ufshcd.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 9c26e8767515..97e50bccb95c 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3118,8 +3118,13 @@ ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
>   	case UPIU_TRANSACTION_QUERY_RSP: {
>   		u8 response = lrbp->ucd_rsp_ptr->header.response;
>   
> -		if (response == 0)
> +		if (response == 0) {
>   			err = ufshcd_copy_query_response(hba, lrbp);
> +		} else {
> +			err = -EINVAL;
> +			dev_err(hba->dev, "%s: unexpected response in Query RSP: %x\n",
> +					__func__, response);
> +		}
>   		break;
>   	}
>   	case UPIU_TRANSACTION_REJECT_UPIU:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9c26e8767515..97e50bccb95c 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3118,8 +3118,13 @@  ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 	case UPIU_TRANSACTION_QUERY_RSP: {
 		u8 response = lrbp->ucd_rsp_ptr->header.response;
 
-		if (response == 0)
+		if (response == 0) {
 			err = ufshcd_copy_query_response(hba, lrbp);
+		} else {
+			err = -EINVAL;
+			dev_err(hba->dev, "%s: unexpected response in Query RSP: %x\n",
+					__func__, response);
+		}
 		break;
 	}
 	case UPIU_TRANSACTION_REJECT_UPIU: