net/sfc: avoid usage of possibly uninitialized link mode
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 12 Jan 2017 09:03:20 +0000 (09:03 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 30 Jan 2017 21:18:25 +0000 (22:18 +0100)
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 <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
drivers/net/sfc/sfc_ethdev.c

index 3f0df76..d13b6d6 100644 (file)
@@ -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, &current_link);
 
                if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,