[PATCH 04/12] net/xsc: remove always-true if expressions

Renyong Wan wanry at yunsilicon.com
Sat Feb 22 04:57:40 CET 2025


This issue was reported by PVS studio, described as:
https://pvs-studio.com/en/docs/warnings/v547/

Signed-off-by: Renyong Wan <wanry at yunsilicon.com>
---
 drivers/net/xsc/xsc_ethdev.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index b9675a5218..0729d43884 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -721,16 +721,13 @@ xsc_ethdev_init_one_representor(struct rte_eth_dev *eth_dev, void *init_params)
 		config->tso = 0;
 	} else {
 		config->tso = 1;
-		if (config->tso)
-			config->tso_max_payload_sz = 1500;
+		config->tso_max_payload_sz = 1500;
 	}
 
-	priv->is_representor = (priv->eth_type == RTE_ETH_REPRESENTOR_NONE) ? 0 : 1;
-	if (priv->is_representor) {
-		eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
-		eth_dev->data->representor_id = priv->representor_id;
-		eth_dev->data->backer_port_id = eth_dev->data->port_id;
-	}
+	priv->is_representor = 1;
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
+	eth_dev->data->representor_id = priv->representor_id;
+	eth_dev->data->backer_port_id = eth_dev->data->port_id;
 
 	eth_dev->dev_ops = &xsc_eth_dev_ops;
 	eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
-- 
2.25.1


More information about the dev mailing list