[dpdk-dev] [PATCH 1/4] net/sfc: avoid usage of possibly uninitialized link_mode

Andrew Rybchenko arybchenko at solarflare.com
Thu Jan 12 10:03:20 CET 2017


In fact efx_port_poll() always initializes it, but it isn't
explicitly documented feature of the API. Moreover, the API
annocation suggests that return code should be checked.

Fixes: 215e8b89d8a8 ("net/sfc: implement device operation to retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Andrew Lee <alee at solarflare.com>
---
 drivers/net/sfc/sfc_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 3f0df76..d13b6d6 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -198,7 +198,8 @@
 	if (wait_to_complete) {
 		efx_link_mode_t link_mode;
 
-		efx_port_poll(sa->nic, &link_mode);
+		if (efx_port_poll(sa->nic, &link_mode) != 0)
+			link_mode = EFX_LINK_UNKNOWN;
 		sfc_port_link_mode_to_info(link_mode, &current_link);
 
 		if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
-- 
1.8.2.3



More information about the dev mailing list