summaryrefslogtreecommitdiff
path: root/drivers/staging/qlge
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-03-22 18:06:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-22 17:11:26 +0100
commitf7bff017741d98567265ed6a6449311a51810fb6 (patch)
tree5d4755790f66b9d004d2fc0de2956008371793d8 /drivers/staging/qlge
parentac3d71e0cbf52064c127f7a7d0e1091637a2c24b (diff)
staging: qlge: fix an error code in probe()
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@oracle.com> Link: https://lore.kernel.org/r/YFiyicHI189PXrha@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/qlge')
-rw-r--r--drivers/staging/qlge/qlge_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 2682a0e474bd..e11470910ef3 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4549,7 +4549,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)
@@ -4560,8 +4560,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;