diff mbox series

scsi: ufs: Adjust ufshcd_hold() during sending attribute requests

Message ID 1606973132-5937-1-git-send-email-user@jang-Samsung-DeskTop-System
State New
Headers show
Series scsi: ufs: Adjust ufshcd_hold() during sending attribute requests | expand

Commit Message

Jintae Jang Dec. 3, 2020, 5:25 a.m. UTC
From: jintae jang <jt77.jang@samsung.com>

Invalidation check of arguments should have been checked before
ufshcd_hold(). It can help to prevent ufshcd_hold()/
ufshcd_release() from being invoked unnecessarily.

Signed-off-by: jintae jang <jt77.jang@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Martin K. Petersen Dec. 7, 2020, 11:33 p.m. UTC | #1
Jintae,

> Invalidation check of arguments should have been checked before

> ufshcd_hold(). It can help to prevent ufshcd_hold()/ ufshcd_release()

> from being invoked unnecessarily.


Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Martin K. Petersen Dec. 9, 2020, 5:23 p.m. UTC | #2
On Thu, 3 Dec 2020 14:25:32 +0900, Jintae Jang wrote:

> Invalidation check of arguments should have been checked before

> ufshcd_hold(). It can help to prevent ufshcd_hold()/

> ufshcd_release() from being invoked unnecessarily.


Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests
      https://git.kernel.org/mkp/scsi/c/8ca1a40b9f9d

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 51b4e0a..0b60931 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2978,14 +2978,14 @@  int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
 
 	BUG_ON(!hba);
 
-	ufshcd_hold(hba, false);
 	if (!attr_val) {
 		dev_err(hba->dev, "%s: attribute value required for opcode 0x%x\n",
 				__func__, opcode);
-		err = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
+	ufshcd_hold(hba, false);
+
 	mutex_lock(&hba->dev_cmd.lock);
 	ufshcd_init_query(hba, &request, &response, opcode, idn, index,
 			selector);
@@ -3069,21 +3069,20 @@  static int __ufshcd_query_descriptor(struct ufs_hba *hba,
 
 	BUG_ON(!hba);
 
-	ufshcd_hold(hba, false);
 	if (!desc_buf) {
 		dev_err(hba->dev, "%s: descriptor buffer required for opcode 0x%x\n",
 				__func__, opcode);
-		err = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	if (*buf_len < QUERY_DESC_MIN_SIZE || *buf_len > QUERY_DESC_MAX_SIZE) {
 		dev_err(hba->dev, "%s: descriptor buffer size (%d) is out of range\n",
 				__func__, *buf_len);
-		err = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
+	ufshcd_hold(hba, false);
+
 	mutex_lock(&hba->dev_cmd.lock);
 	ufshcd_init_query(hba, &request, &response, opcode, idn, index,
 			selector);