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

From: Qianfeng Rong
Date: Fri Aug 15 2025 - 08:20:04 EST


Use min_t() to reduce the code in qla2x00_alloc_outstanding_cmds() and
improve its readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@xxxxxxxx>
---
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