mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
scsi: ufs: bsg: Clean up ufs_bsg_request()
Move sg_copy_from_buffer() below its associated case statement. Signed-off-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
64d4864714
commit
765ab00dac
@ -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;
|
||||
}
|
||||
|
||||
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:
|
||||
ufshcd_rpm_put_sync(hba);
|
||||
kfree(desc_buff);
|
||||
bsg_reply->result = ret;
|
||||
job->reply_len = sizeof(struct ufs_bsg_reply);
|
||||
/* complete the job here only if no error */
|
||||
|
Loading…
Reference in New Issue
Block a user