From c7c915e1e3c81fb51fa881efe89e694a0b5b8817 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 12 Jan 2017 09:03:20 +0000 Subject: [PATCH] net/sfc: avoid usage of possibly uninitialized link mode 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: 886f8d8a05bf ("net/sfc: retrieve link info") Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee --- 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 3f0df76858..d13b6d69e5 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -198,7 +198,8 @@ retry: 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, ¤t_link); if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link, -- 2.20.1