@@ -1325,7 +1325,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba,
ufshcd_init_query(hba, &request, &response, opcode, idn, index,
selector);
hba->dev_cmd.query.descriptor = desc_buf;
- request->upiu_req.length = *buf_len;
+ request->upiu_req.length = cpu_to_be16(*buf_len);
switch (opcode) {
case UPIU_QUERY_OPCODE_WRITE_DESC:
@@ -1351,7 +1351,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba,
}
hba->dev_cmd.query.descriptor = NULL;
- *buf_len = response->upiu_res.length;
+ *buf_len = be16_to_cpu(response->upiu_res.length);
out_unlock:
mutex_unlock(&hba->dev_cmd.lock);