2023-05-03 10:51:05

by Keoseong Park

[permalink] [raw]
Subject: [PATCH] scsi: ufs: core: Return earlier if ufshcd_hba_init_crypto_capabilities() fails

The 'err' variable is used only as the result of
ufshcd_hba_init_crypto_capabilities(), so return 'err' immediately when
failed. If it is not an error, explicitly return 0.

Signed-off-by: Keoseong Park <[email protected]>
---
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;
}

/**
--
2.17.1