All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests
       [not found] <CGME20201203053818epcas1p2aef4dce58afcac06fb28354146254c8d@epcas1p2.samsung.com>
@ 2020-12-03  5:25 ` Jintae Jang
  2020-12-03  6:03   ` Stanley Chu
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jintae Jang @ 2020-12-03  5:25 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, jt77.jang

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(-)

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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests
  2020-12-03  5:25 ` [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests Jintae Jang
@ 2020-12-03  6:03   ` Stanley Chu
  2020-12-07 23:33   ` Martin K. Petersen
  2020-12-09 17:23   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Stanley Chu @ 2020-12-03  6:03 UTC (permalink / raw)
  To: Jintae Jang; +Cc: linux-scsi, martin.petersen, jt77.jang

On Thu, 2020-12-03 at 14:25 +0900, Jintae Jang wrote:
> 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>

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests
  2020-12-03  5:25 ` [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests Jintae Jang
  2020-12-03  6:03   ` Stanley Chu
@ 2020-12-07 23:33   ` Martin K. Petersen
  2020-12-09 17:23   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-12-07 23:33 UTC (permalink / raw)
  To: Jintae Jang; +Cc: linux-scsi, martin.petersen, jt77.jang


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests
  2020-12-03  5:25 ` [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests Jintae Jang
  2020-12-03  6:03   ` Stanley Chu
  2020-12-07 23:33   ` Martin K. Petersen
@ 2020-12-09 17:23   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-12-09 17:23 UTC (permalink / raw)
  To: linux-scsi, jt77.jang; +Cc: Martin K . Petersen

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-09 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201203053818epcas1p2aef4dce58afcac06fb28354146254c8d@epcas1p2.samsung.com>
2020-12-03  5:25 ` [PATCH] scsi: ufs: Adjust ufshcd_hold() during sending attribute requests Jintae Jang
2020-12-03  6:03   ` Stanley Chu
2020-12-07 23:33   ` Martin K. Petersen
2020-12-09 17:23   ` Martin K. Petersen

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.