netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org (open list),
	Zheyu Ma <zheyuma97@gmail.com>, Nick Bowler <nbowler@draconx.ca>,
	Rolf Eike Beer <eike-kernel@sf-tec.de>,
	Sean Anderson <seanga2@gmail.com>
Subject: [PATCH net-next 05/13] sunhme: Regularize probe errors
Date: Sun, 18 Sep 2022 19:26:18 -0400	[thread overview]
Message-ID: <20220918232626.1601885-6-seanga2@gmail.com> (raw)
In-Reply-To: <20220918232626.1601885-1-seanga2@gmail.com>

This fixes several error paths to ensure they return an appropriate error
(instead of ENODEV).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

 drivers/net/ethernet/sun/sunhme.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index 52247505d08e..f0b77bdf51dd 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2948,7 +2948,6 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_out;
 	pci_set_master(pdev);
-	err = -ENODEV;
 
 	if (!strcmp(prom_name, "SUNW,qfe") || !strcmp(prom_name, "qfe")) {
 		qp = quattro_pci_find(pdev);
@@ -2985,18 +2984,22 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 	}
 
 	hpreg_res = pci_resource_start(pdev, 0);
-	err = -ENODEV;
+	err = -EINVAL;
 	if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) {
 		printk(KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n");
 		goto err_out_clear_quattro;
 	}
-	if (pci_request_regions(pdev, DRV_NAME)) {
+
+	err = pci_request_regions(pdev, DRV_NAME);
+	if (err) {
 		printk(KERN_ERR "happymeal(PCI): Cannot obtain PCI resources, "
 		       "aborting.\n");
 		goto err_out_clear_quattro;
 	}
 
-	if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == NULL) {
+	hpreg_base = ioremap(hpreg_res, 0x8000);
+	err = -ENOMEM;
+	if (!hpreg_base) {
 		printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n");
 		goto err_out_free_res;
 	}
@@ -3066,7 +3069,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 
 	hp->happy_block = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
 					     &hp->hblock_dvma, GFP_KERNEL);
-	err = -ENODEV;
+	err = -ENOMEM;
 	if (!hp->happy_block)
 		goto err_out_iounmap;
 
-- 
2.37.1


  parent reply	other threads:[~2022-09-18 23:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 23:26 [PATCH net-next 00/13] net: sunhme: Cleanups and logging improvements Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 01/13] sunhme: remove unused tx_dump_ring() Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 02/13] sunhme: Remove version Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 03/13] sunhme: forward the error code from pci_enable_device() Sean Anderson
2022-09-20 19:37   ` Jakub Kicinski
2022-09-18 23:26 ` [PATCH net-next 04/13] sunhme: Return an ERR_PTR from quattro_pci_find Sean Anderson
2022-09-19 13:11   ` Rolf Eike Beer
2022-09-19 14:08     ` Sean Anderson
2022-09-20 19:36   ` Jakub Kicinski
2022-09-18 23:26 ` Sean Anderson [this message]
2022-09-20 19:36   ` [PATCH net-next 05/13] sunhme: Regularize probe errors Jakub Kicinski
2022-09-18 23:26 ` [PATCH net-next 06/13] sunhme: switch to devres Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 07/13] sumhme: Convert FOO((...)) to FOO(...) Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 08/13] sunhme: Clean up debug infrastructure Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 09/13] sunhme: Convert printk(KERN_FOO ...) to pr_foo(...) Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 10/13] sunhme: Use (net)dev_foo wherever possible Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 11/13] sunhme: Combine continued messages Sean Anderson
2022-09-19 13:23   ` Rolf Eike Beer
2022-09-19 14:14     ` Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 12/13] sunhme: Use vdbg for spam-y prints Sean Anderson
2022-09-18 23:26 ` [PATCH net-next 13/13] sunhme: Add myself as a maintainer Sean Anderson

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=20220918232626.1601885-6-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eike-kernel@sf-tec.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbowler@draconx.ca \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zheyuma97@gmail.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).