[dpdk-dev] [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

Stephen Hemminger stephen at networkplumber.org
Fri Aug 17 00:44:09 CEST 2018


Function is boolean so use that.

Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
---
 lib/librte_ethdev/rte_ethdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index f09bf8bc8b01..f0336736b7c1 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -389,13 +389,11 @@ rte_eth_dev_is_valid_port(uint16_t port_id)
 		return 1;
 }
 
-static int
+static bool
 rte_eth_is_valid_owner_id(uint64_t owner_id)
 {
-	if (owner_id == RTE_ETH_DEV_NO_OWNER ||
-	    rte_eth_dev_shared_data->next_owner_id <= owner_id)
-		return 0;
-	return 1;
+	return !(owner_id == RTE_ETH_DEV_NO_OWNER ||
+		 rte_eth_dev_shared_data->next_owner_id <= owner_id);
 }
 
 uint64_t
-- 
2.18.0



More information about the dev mailing list