DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/4] net/sfc: avoid usage of possibly uninitialized link_mode
Date: Thu, 12 Jan 2017 09:03:20 +0000	[thread overview]
Message-ID: <1484211803-21449-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1484211803-21449-1-git-send-email-arybchenko@solarflare.com>

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@solarflare.com>
Reviewed-by: Andrew Lee <alee@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

  reply	other threads:[~2017-01-12  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  9:03 [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Andrew Rybchenko
2017-01-12  9:03 ` Andrew Rybchenko [this message]
2017-01-12  9:03 ` [dpdk-dev] [PATCH 2/4] net/sfc: sync link status knowledge with HW on start Andrew Rybchenko
2017-01-12  9:03 ` [dpdk-dev] [PATCH 3/4] net/sfc: report correct link status when port is not started Andrew Rybchenko
2017-01-12  9:03 ` [dpdk-dev] [PATCH 4/4] net/sfc: fix flow control settings set on port start Andrew Rybchenko
2017-01-16 17:07 ` [dpdk-dev] [PATCH 0/4] Solarflare PMD link status and flow control fixes Ferruh Yigit
2017-01-18 19:23 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484211803-21449-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).