From ae278517f9f6bcaebb36c5930a8ca9ae615cd7c9 Mon Sep 17 00:00:00 2001 From: Ziqin Liu Date: Sat, 6 May 2023 20:53:06 +0800 Subject: [PATCH] scsi/hifc: replace divide condition with comparison operator driver inclusion category: other bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZETB Reference: N/A --------------------------------------- since comparison operator is faster than division, the operations (*v_xchg_sum / UNF_EXCHG_MGR_NUM) == 0 and port_cfg_items->max_sfs_xchg / UNF_EXCHG_MGR_NUM == 0 in the conditional statements should be replaced with equivalent relational operations that have the same semantics. Signed-off-by: Ziqin Liu --- drivers/scsi/huawei/hifc/unf_exchg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/huawei/hifc/unf_exchg.c b/drivers/scsi/huawei/hifc/unf_exchg.c index f3234a9edc22..a4d1c15c67f9 100644 --- a/drivers/scsi/huawei/hifc/unf_exchg.c +++ b/drivers/scsi/huawei/hifc/unf_exchg.c @@ -481,8 +481,8 @@ static unsigned int unf_get_xchg_config_sum(struct unf_lport_s *v_lport, * Don't need to check it again. */ *v_xchg_sum = lport_cfg_items->max_sfs_xchg + lport_cfg_items->max_io; - if ((*v_xchg_sum / UNF_EXCHG_MGR_NUM) == 0 || - lport_cfg_items->max_sfs_xchg / UNF_EXCHG_MGR_NUM == 0) { + if (*v_xchg_sum < UNF_EXCHG_MGR_NUM || + lport_cfg_items->max_sfs_xchg < UNF_EXCHG_MGR_NUM) { UNF_TRACE(UNF_EVTLOG_DRIVER_ERR, UNF_LOG_REG_ATT, UNF_ERR, "[err]Port(0x%x) Xchgsum(%u) or SfsXchg(%u) is less than ExchangeMgrNum(%u).", v_lport->port_id, *v_xchg_sum, -- Gitee