From: Zheyu Ma <zheyuma97@gmail.com>
To: andrew@lunn.ch, rajur@chelsio.com, davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Zheyu Ma <zheyuma97@gmail.com>
Subject: [PATCH v2] net: cxgb3: Fix an error code when probing the driver
Date: Sun, 6 Mar 2022 05:56:32 +0000 [thread overview]
Message-ID: <1646546192-32737-1-git-send-email-zheyuma97@gmail.com> (raw)
In-Reply-To: <1646490284-22791-1-git-send-email-zheyuma97@gmail.com>
During the process of driver probing, probe function should return < 0
for failure, otherwise kernel will treat value >= 0 as success.
Therefore, the driver should set 'err' to -ENODEV when
'adapter->registered_device_map' is NULL. Otherwise kernel will assume
that the driver has been successfully probed and will cause unexpected
errors.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
Changes in v2:
- Change the error code
---
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index bfffcaeee624..0d3325cf2107 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -3346,6 +3346,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
}
if (!adapter->registered_device_map) {
dev_err(&pdev->dev, "could not register any net devices\n");
+ err = -ENODEV;
goto out_free_dev;
}
--
2.25.1
next prev parent reply other threads:[~2022-03-06 5:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-05 14:24 [PATCH] net: cxgb3: Fix an error code when probing the driver Zheyu Ma
2022-03-05 15:40 ` Andrew Lunn
2022-03-06 5:56 ` Zheyu Ma [this message]
2022-03-06 15:15 ` [PATCH v2] " Andrew Lunn
2022-03-08 6:30 ` 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=1646546192-32737-1-git-send-email-zheyuma97@gmail.com \
--to=zheyuma97@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rajur@chelsio.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).