Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Peter Wang <peter.wang@mediatek.com>,
	Avri Altman <avri.altman@sandisk.com>,
	Bean Huo <beanhuo@micron.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Can Guo <can.guo@oss.qualcomm.com>
Subject: [PATCH 2/3] ufs: core: Complain if UIC argument 2 is invalid
Date: Fri, 17 Apr 2026 14:30:21 -0700	[thread overview]
Message-ID: <20260417213027.3506742-3-bvanassche@acm.org> (raw)
In-Reply-To: <20260417213027.3506742-1-bvanassche@acm.org>

According to the UFSHCI standard, the lowest byte of UIC argument 2 is
an output value. Additionally, ufshcd_uic_cmd_compl() is based on the
assumption that the lowest byte of UIC argument 2 is zero. Hence, complain
if the result byte is set when a UIC command is submitted.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7fb3921bceb2..0ff9d7c2a7ac 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2571,6 +2571,7 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 	lockdep_assert_held(&hba->uic_cmd_mutex);
 
 	WARN_ON(hba->active_uic_cmd);
+	WARN_ON_ONCE(uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT);
 
 	hba->active_uic_cmd = uic_cmd;
 

  parent reply	other threads:[~2026-04-17 21:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 21:30 [PATCH 0/3] ufs: core: Optimize the UIC command implementation Bart Van Assche
2026-04-17 21:30 ` [PATCH 1/3] ufs: core: Inline two functions related to UIC commands Bart Van Assche
2026-04-21  8:41   ` Peter Wang (王信友)
2026-04-17 21:30 ` Bart Van Assche [this message]
2026-04-21  8:42   ` [PATCH 2/3] ufs: core: Complain if UIC argument 2 is invalid Peter Wang (王信友)
2026-04-17 21:30 ` [PATCH 3/3] ufs: core: Optimize ufshcd_add_uic_command_trace() Bart Van Assche
2026-04-21  8:45   ` Peter Wang (王信友)
2026-04-21 19:37     ` Bart Van Assche
2026-04-22  7:52       ` Peter Wang (王信友)
2026-04-22 16:30         ` Bart Van Assche
2026-04-23  8:08           ` Peter Wang (王信友)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260417213027.3506742-3-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=can.guo@oss.qualcomm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox