From: Bean Huo <beanhuo@iokpp.de>
To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, stanley.chu@mediatek.com,
beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com,
daejun7.park@samsung.com, quic_cang@quicinc.com,
quic_nguyenb@quicinc.com, quic_xiaosenh@quicinc.com,
quic_richardp@quicinc.com, quic_asutoshd@quicinc.com,
hare@suse.de
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/6] ufs: ufs_bsg: Cleanup ufs_bsg_request
Date: Sun, 20 Nov 2022 23:22:13 +0100 [thread overview]
Message-ID: <20221120222217.108492-3-beanhuo@iokpp.de> (raw)
In-Reply-To: <20221120222217.108492-1-beanhuo@iokpp.de>
From: Bean Huo <beanhuo@micron.com>
Move sg_copy_from_buffer() below its associated case statement.
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
drivers/ufs/core/ufs_bsg.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c
index 9ac8204f1ee6..850a0d798f63 100644
--- a/drivers/ufs/core/ufs_bsg.c
+++ b/drivers/ufs/core/ufs_bsg.c
@@ -90,11 +90,8 @@ static int ufs_bsg_request(struct bsg_job *job)
desc_op = bsg_request->upiu_req.qr.opcode;
ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff,
&desc_len, desc_op);
- if (ret) {
- ufshcd_rpm_put_sync(hba);
+ if (ret)
goto out;
- }
-
fallthrough;
case UPIU_TRANSACTION_NOP_OUT:
case UPIU_TRANSACTION_TASK_REQ:
@@ -102,9 +99,12 @@ static int ufs_bsg_request(struct bsg_job *job)
&bsg_reply->upiu_rsp, msgcode,
desc_buff, &desc_len, desc_op);
if (ret)
- dev_err(hba->dev,
- "exe raw upiu: error code %d\n", ret);
-
+ dev_err(hba->dev, "exe raw upiu: error code %d\n", ret);
+ else if (desc_op == UPIU_QUERY_OPCODE_READ_DESC && desc_len)
+ bsg_reply->reply_payload_rcv_len =
+ sg_copy_from_buffer(job->request_payload.sg_list,
+ job->request_payload.sg_cnt,
+ desc_buff, desc_len);
break;
case UPIU_TRANSACTION_UIC_CMD:
memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE);
@@ -123,20 +123,9 @@ static int ufs_bsg_request(struct bsg_job *job)
break;
}
+out:
ufshcd_rpm_put_sync(hba);
-
- if (!desc_buff)
- goto out;
-
- if (desc_op == UPIU_QUERY_OPCODE_READ_DESC && desc_len)
- bsg_reply->reply_payload_rcv_len =
- sg_copy_from_buffer(job->request_payload.sg_list,
- job->request_payload.sg_cnt,
- desc_buff, desc_len);
-
kfree(desc_buff);
-
-out:
bsg_reply->result = ret;
job->reply_len = sizeof(struct ufs_bsg_reply);
/* complete the job here only if no error */
--
2.25.1
next prev parent reply other threads:[~2022-11-20 22:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-20 22:22 [PATCH v2 0/6] UFS Advanced RPMB Bean Huo
2022-11-20 22:22 ` [PATCH v2 1/6] ufs: ufs_bsg: Remove unnecessary length checkup Bean Huo
2022-12-01 6:46 ` Avri Altman
2022-11-20 22:22 ` Bean Huo [this message]
2022-11-22 7:51 ` [PATCH v2 2/6] ufs: ufs_bsg: Cleanup ufs_bsg_request Avri Altman
2022-11-20 22:22 ` [PATCH v2 3/6] ufs: core: Split ufshcd_map_sg Bean Huo
2022-11-22 8:15 ` Avri Altman
2022-11-24 14:43 ` Bean Huo
2022-11-20 22:22 ` [PATCH v2 4/6] ufs: core: Advanced RPMB detection Bean Huo
2022-11-22 9:11 ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 5/6] ufs: core: Pass EHS length into ufshcd_prepare_req_desc_hdr() Bean Huo
2022-11-22 9:41 ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 6/6] ufs: core: Add advanced RPMB support in ufs_bsg Bean Huo
2022-11-22 11:05 ` Avri Altman
2022-11-22 11:27 ` Avri Altman
2022-11-22 11:55 ` Avri Altman
2022-11-28 19:01 ` Bean Huo
2022-11-28 20:07 ` Avri Altman
-- strict thread matches above, loose matches on Subject: below --
2022-11-20 21:59 [PATCH v2 0/6] UFS Advanced RPMB Bean Huo
2022-11-20 21:59 ` [PATCH v2 2/6] ufs: ufs_bsg: Cleanup ufs_bsg_request Bean Huo
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=20221120222217.108492-3-beanhuo@iokpp.de \
--to=beanhuo@iokpp.de \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=daejun7.park@samsung.com \
--cc=hare@suse.de \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_richardp@quicinc.com \
--cc=quic_xiaosenh@quicinc.com \
--cc=stanley.chu@mediatek.com \
--cc=tomas.winkler@intel.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;
as well as URLs for NNTP newsgroup(s).