[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210512144844.220920807@linuxfoundation.org>
Date: Wed, 12 May 2021 16:44:16 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Dan Carpenter <dan.carpenter@...cle.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.12 210/677] staging: qlge: fix an error code in probe()
From: Dan Carpenter <dan.carpenter@...cle.com>
[ Upstream commit f7bff017741d98567265ed6a6449311a51810fb6 ]
If alloc_etherdev_mq() fails then return -ENOMEM instead of success.
The "err = 0;" triggers an unused assignment now so remove that as
well.
Fixes: 953b94009377 ("staging: qlge: Initialize devlink health dump framework")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Link: https://lore.kernel.org/r/YFiyicHI189PXrha@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/staging/qlge/qlge_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 5516be3af898..c1d52190e1bd 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4550,7 +4550,7 @@ static int qlge_probe(struct pci_dev *pdev,
struct net_device *ndev = NULL;
struct devlink *devlink;
static int cards_found;
- int err = 0;
+ int err;
devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_adapter));
if (!devlink)
@@ -4561,8 +4561,10 @@ static int qlge_probe(struct pci_dev *pdev,
ndev = alloc_etherdev_mq(sizeof(struct qlge_netdev_priv),
min(MAX_CPUS,
netif_get_num_default_rss_queues()));
- if (!ndev)
+ if (!ndev) {
+ err = -ENOMEM;
goto devlink_free;
+ }
ndev_priv = netdev_priv(ndev);
ndev_priv->qdev = qdev;
--
2.30.2
Powered by blists - more mailing lists