public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denis Plotnikov <den-plotnikov@yandex-team.ru>
To: GR-Linux-NIC-Dev@marvell.com
Cc: manishc@marvell.com, rahulv@marvell.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Subject: [PATCH] net: netxen: report error on version offset reading
Date: Wed, 29 Mar 2023 19:26:29 +0300	[thread overview]
Message-ID: <20230329162629.96590-1-den-plotnikov@yandex-team.ru> (raw)

A static analyzer complains for non-checking the function returning value.
Although, the code looks like not expecting any problems with version
reading on netxen_p3_has_mn call, it seems the error still may happen.
So, at least, add error reporting to ease problems investigation.

Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index 35ec9aab3dc7b..92962dbb73ad0 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -1192,8 +1192,13 @@ netxen_p3_has_mn(struct netxen_adapter *adapter)
 	if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
 		return 1;
 
-	netxen_rom_fast_read(adapter,
-			NX_FW_VERSION_OFFSET, (int *)&flashed_ver);
+	if (netxen_rom_fast_read(adapter,
+			NX_FW_VERSION_OFFSET, (int *)&flashed_ver)) {
+		printk(KERN_ERR "%s: ERROR on flashed version reading",
+				netxen_nic_driver_name);
+		return 0;
+	}
+
 	flashed_ver = NETXEN_DECODE_VERSION(flashed_ver);
 
 	if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) {
-- 
2.25.1


             reply	other threads:[~2023-03-29 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 16:26 Denis Plotnikov [this message]
2023-03-29 18:59 ` [PATCH] net: netxen: report error on version offset reading Leon Romanovsky
2023-03-30  6:01   ` Denis Plotnikov

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=20230329162629.96590-1-den-plotnikov@yandex-team.ru \
    --to=den-plotnikov@yandex-team.ru \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rahulv@marvell.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