netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Plotnikov <den-plotnikov@yandex-team.ru>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, anirban.chakraborty@qlogic.com,
	sony.chacko@qlogic.com, GR-Linux-NIC-Dev@marvell.com,
	helgaas@kernel.org, simon.horman@corigine.com,
	manishc@marvell.com, shshaikh@marvell.com,
	den-plotnikov@yandex-team.ru
Subject: [PATCH net-next v2] qlcnic: check pci_reset_function result
Date: Fri,  7 Apr 2023 10:18:49 +0300	[thread overview]
Message-ID: <20230407071849.309516-1-den-plotnikov@yandex-team.ru> (raw)

Static code analyzer complains to unchecked return value.
The result of pci_reset_function() is unchecked.
Despite, the issue is on the FLR supported code path and in that
case reset can be done with pcie_flr(), the patch uses less invasive
approach by adding the result check of pci_reset_function().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 7e2cf4feba05 ("qlcnic: change driver hardware interface mechanism")
Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index 87f76bac2e463..eb827b86ecae8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -628,7 +628,13 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev)
 	int i, err, ring;
 
 	if (dev->flags & QLCNIC_NEED_FLR) {
-		pci_reset_function(dev->pdev);
+		err = pci_reset_function(dev->pdev);
+		if (err) {
+			dev_err(&dev->pdev->dev,
+				"Adapter reset failed (%d). Please reboot\n",
+				err);
+			return err;
+		}
 		dev->flags &= ~QLCNIC_NEED_FLR;
 	}
 
-- 
2.25.1


             reply	other threads:[~2023-04-07  7:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  7:18 Denis Plotnikov [this message]
2023-04-07  9:01 ` [PATCH net-next v2] qlcnic: check pci_reset_function result Simon Horman
2023-04-07 15:31   ` Bjorn Helgaas
2023-04-11 11:24 ` Paolo Abeni
2023-04-11 11:31   ` Simon Horman
2023-04-12  7:40 ` patchwork-bot+netdevbpf

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=20230407071849.309516-1-den-plotnikov@yandex-team.ru \
    --to=den-plotnikov@yandex-team.ru \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=anirban.chakraborty@qlogic.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=shshaikh@marvell.com \
    --cc=simon.horman@corigine.com \
    --cc=sony.chacko@qlogic.com \
    /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).