[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR04MB657526124CB8A463C1093CB4FC0D9@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Tue, 22 Nov 2022 07:51:43 +0000
From: Avri Altman <Avri.Altman@....com>
To: Bean Huo <beanhuo@...pp.de>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
"beanhuo@...ron.com" <beanhuo@...ron.com>,
"bvanassche@....org" <bvanassche@....org>,
"tomas.winkler@...el.com" <tomas.winkler@...el.com>,
"daejun7.park@...sung.com" <daejun7.park@...sung.com>,
"quic_cang@...cinc.com" <quic_cang@...cinc.com>,
"quic_nguyenb@...cinc.com" <quic_nguyenb@...cinc.com>,
"quic_xiaosenh@...cinc.com" <quic_xiaosenh@...cinc.com>,
"quic_richardp@...cinc.com" <quic_richardp@...cinc.com>,
"quic_asutoshd@...cinc.com" <quic_asutoshd@...cinc.com>,
"hare@...e.de" <hare@...e.de>
CC: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 2/6] ufs: ufs_bsg: Cleanup ufs_bsg_request
>
> From: Bean Huo <beanhuo@...ron.com>
>
> Move sg_copy_from_buffer() below its associated case statement.
>
> Signed-off-by: Bean Huo <beanhuo@...ron.com>
Reviewed-by: Avri Altman <avri.altman@....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
Powered by blists - more mailing lists