mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: keosung.park@samsung.com, ALIM AKHTAR <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"mani@kernel.org" <mani@kernel.org>,
	"quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: ufs: core: Use readable 'return 0' in ufshcd_hba_capabilities()
Date: Tue, 2 May 2023 13:28:45 -0700	[thread overview]
Message-ID: <28ea2183-d1ce-f42d-1765-9d07d7481eda@acm.org> (raw)
In-Reply-To: <20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p7>

On 5/2/23 04:31, Keoseong Park wrote:
> The 'err' variable is the result of ufshcd_hba_init_crypto_capabilities()
> regardless of MCQ capabilities. Return 'err' immediately when the function
> error occurs. And if it is not an error, explicitly return 0.
> 
> Anyway, if ufshcd_hba_init_crypto_capabilities() returns error, MCQ
> capabilities is not used because it fails to initialize UFS driver.
> 
> Signed-off-by: Keoseong Park <keosung.park@samsung.com>
> ---
>   drivers/ufs/core/ufshcd.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 9434328ba323..44328eb4158d 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2343,18 +2343,20 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
>   
>   	/* Read crypto capabilities */
>   	err = ufshcd_hba_init_crypto_capabilities(hba);
> -	if (err)
> +	if (err) {
>   		dev_err(hba->dev, "crypto setup failed\n");
> +		return err;
> +	}
>   
>   	hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);
>   	if (!hba->mcq_sup)
> -		return err;
> +		return 0;
>   
>   	hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP);
>   	hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT,
>   				     hba->mcq_capabilities);
>   
> -	return err;
> +	return 0;
>   }

The most important change in this patch is that ufshcd_hba_capabilities()
returns earlier if ufshcd_hba_init_crypto_capabilities() fails. Please
change the patch title such that it reflects this change instead of the
other less important change.

Thanks,

Bart.


  reply	other threads:[~2023-05-02 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p7>
2023-05-02 11:31 ` Keoseong Park
2023-05-02 20:28   ` Bart Van Assche [this message]
     [not found]   ` <CGME20230502113116epcms2p7b83da0d683e29f667c38f5430b985388@epcms2p5>
2023-05-03  6:50     ` Keoseong Park

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=28ea2183-d1ce-f42d-1765-9d07d7481eda@acm.org \
    --to=bvanassche@acm.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.ibm.com \
    --cc=keosung.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=stanley.chu@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

all inboxes | Powered by JetHome®