[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1637634110-3013-1-git-send-email-zheyuma97@gmail.com>
Date: Tue, 23 Nov 2021 02:21:50 +0000
From: Zheyu Ma <zheyuma97@...il.com>
To: rajur@...lsio.com, davem@...emloft.net, kuba@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Zheyu Ma <zheyuma97@...il.com>
Subject: [PATCH] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()
During the process of driver probing, probe function should return < 0
for failure, otherwise kernel will treat value == 0 as success.
Therefore, we should set err to -EINVAL when
adapter->registered_device_map is NULL. Otherwise kernel will assume
that driver has been successfully probed and will cause unexpected
errors.
Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
---
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index 64479c464b4e..ae9cca768d74 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -3196,6 +3196,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
}
if (adapter->registered_device_map == 0) {
dev_err(&pdev->dev, "could not register any net devices\n");
+ err = -EINVAL;
goto err_disable_interrupts;
}
--
2.25.1
Powered by blists - more mailing lists