[PATCH 6/6] scsi: qla2xxx: use min() to improve code

Qianfeng Rong posted 6 patches 1 month, 2 weeks ago
[PATCH 6/6] scsi: qla2xxx: use min() to improve code
Posted by Qianfeng Rong 1 month, 2 weeks ago
Use min_t() to reduce the code in qla2x00_alloc_outstanding_cmds() and
improve its readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index be211ff22acb..52fc5b8932e3 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4020,12 +4020,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
 
 	if (!IS_FWI2_CAPABLE(ha))
 		req->num_outstanding_cmds = DEFAULT_OUTSTANDING_COMMANDS;
-	else {
-		if (ha->cur_fw_xcb_count <= ha->cur_fw_iocb_count)
-			req->num_outstanding_cmds = ha->cur_fw_xcb_count;
-		else
-			req->num_outstanding_cmds = ha->cur_fw_iocb_count;
-	}
+	else
+		req->num_outstanding_cmds = min(ha->cur_fw_xcb_count,
+						ha->cur_fw_iocb_count);
 
 	req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
 					sizeof(srb_t *),
-- 
2.34.1