All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@wdc.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Gilad Broner <gbroner@codeaurora.org>,
	Yaniv Gardi <ygardi@codeaurora.org>,
	Subhash Jadavani <subhashj@codeaurora.org>,
	Dolev Raviv <draviv@codeaurora.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Can Guo <cang@codeaurora.org>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
	Asutosh Das <asutoshd@codeaurora.org>
Subject: RE: [PATCH RFC 2/4] ufs: Remove a check from ufshcd_queuecommand()
Date: Mon, 21 Jun 2021 08:22:00 +0000	[thread overview]
Message-ID: <DM6PR04MB6575D553EA3E6938FEAC0F9DFC0A9@DM6PR04MB6575.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20210619005228.28569-3-bvanassche@acm.org>

> scsi_add_host() allocates shost->can_queue tags. ufshcd_init() sets
> shost->can_queue to hba->nutrs. In other words, we know that tag values
> will be in the range [0, hba->nutrs). Remove a check that verifies what
> we already know. This check was introduced by commit 14497328b6a6
> ("scsi:
> ufs: verify command tag validity").
> 
> Cc: Gilad Broner <gbroner@codeaurora.org>
> Cc: Yaniv Gardi <ygardi@codeaurora.org>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Dolev Raviv <draviv@codeaurora.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index c230d2a6a55c..71c720d940a3 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -2701,21 +2701,11 @@ static void ufshcd_init_lrb(struct ufs_hba *hba,
> struct ufshcd_lrb *lrb, int i)
>   */
>  static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd
> *cmd)
>  {
> +       struct ufs_hba *hba = shost_priv(host);
> +       int tag = cmd->request->tag;
>         struct ufshcd_lrb *lrbp;
> -       struct ufs_hba *hba;
> -       int tag;
>         int err = 0;
> 
> -       hba = shost_priv(host);
> -
> -       tag = cmd->request->tag;
> -       if (!ufshcd_valid_tag(hba, tag)) {
> -               dev_err(hba->dev,
> -                       "%s: invalid command tag %d: cmd=0x%p, cmd-
> >request=0x%p",
> -                       __func__, tag, cmd, cmd->request);
> -               BUG();
> -       }
While at it, maybe remove ufshcd_valid_tag altogether?

Thanks,
Avri
> -
>         if (!down_read_trylock(&hba->clk_scaling_lock))
>                 return SCSI_MLQUEUE_HOST_BUSY;


  reply	other threads:[~2021-06-21  8:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19  0:52 [PATCH RFC 0/4] UFS patches for Linux kernel v5.14 Bart Van Assche
2021-06-19  0:52 ` [PATCH RFC 1/4] ufs: Rename the second ufshcd_probe_hba() argument Bart Van Assche
2021-06-21  8:13   ` Avri Altman
2021-06-19  0:52 ` [PATCH RFC 2/4] ufs: Remove a check from ufshcd_queuecommand() Bart Van Assche
2021-06-21  8:22   ` Avri Altman [this message]
2021-06-21 17:31     ` Bart Van Assche
2021-06-19  0:52 ` [PATCH RFC 3/4] ufs: Improve static type checking for the host controller state Bart Van Assche
2021-06-21  8:26   ` Avri Altman
2021-06-23  7:42   ` Can Guo
2021-06-23 16:10     ` Bart Van Assche
2021-06-19  0:52 ` [PATCH RFC 4/4] ufs: Make host controller state change handling more systematic Bart Van Assche
2021-06-19  7:09   ` kernel test robot
2021-06-21  8:55   ` Avri Altman
2021-06-21 17:38     ` Bart Van Assche
2021-06-23  8:08   ` Can Guo
2021-06-23 12:02   ` Can Guo

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=DM6PR04MB6575D553EA3E6938FEAC0F9DFC0A9@DM6PR04MB6575.namprd04.prod.outlook.com \
    --to=avri.altman@wdc.com \
    --cc=asutoshd@codeaurora.org \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=draviv@codeaurora.org \
    --cc=gbroner@codeaurora.org \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=subhashj@codeaurora.org \
    --cc=ygardi@codeaurora.org \
    /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 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.