From: "Simon Sandström" <simon@nikanor.nu>
To: gregkh@linuxfoundation.org
Cc: dan.carpenter@oracle.com, jeremy@azazel.net,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
"Simon Sandström" <simon@nikanor.nu>
Subject: [PATCH 1/2] staging: kpc2000: improve label names in kp2000_pcie_probe
Date: Mon, 10 Jun 2019 22:05:34 +0200 [thread overview]
Message-ID: <20190610200535.31820-2-simon@nikanor.nu> (raw)
In-Reply-To: <20190610200535.31820-1-simon@nikanor.nu>
Use self-explanatory label names instead of the generic numbered ones,
to make it easier to follow and understand the code.
Signed-off-by: Simon Sandström <simon@nikanor.nu>
---
drivers/staging/kpc2000/kpc2000/core.c | 42 ++++++++++++--------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index 9b9b29ac90c5..ee6b9be7127d 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -327,7 +327,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err < 0) {
dev_err(&pdev->dev, "probe: failed to get card number (%d)\n",
err);
- goto out2;
+ goto err_free_pcard;
}
pcard->card_num = err;
scnprintf(pcard->name, 16, "kpcard%u", pcard->card_num);
@@ -346,7 +346,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(&pcard->pdev->dev,
"probe: failed to enable PCIE2000 PCIe device (%d)\n",
err);
- goto out3;
+ goto err_remove_ida;
}
/*
@@ -360,7 +360,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(&pcard->pdev->dev,
"probe: REG_BAR could not remap memory to virtual space\n");
err = -ENODEV;
- goto out4;
+ goto err_disable_device;
}
dev_dbg(&pcard->pdev->dev,
"probe: REG_BAR virt hardware address start [%p]\n",
@@ -373,7 +373,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
"probe: failed to acquire PCI region (%d)\n",
err);
err = -ENODEV;
- goto out4;
+ goto err_disable_device;
}
pcard->regs_base_resource.start = reg_bar_phys_addr;
@@ -393,7 +393,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(&pcard->pdev->dev,
"probe: DMA_BAR could not remap memory to virtual space\n");
err = -ENODEV;
- goto out5;
+ goto err_unmap_regs;
}
dev_dbg(&pcard->pdev->dev,
"probe: DMA_BAR virt hardware address start [%p]\n",
@@ -407,7 +407,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(&pcard->pdev->dev,
"probe: failed to acquire PCI region (%d)\n", err);
err = -ENODEV;
- goto out5;
+ goto err_unmap_regs;
}
pcard->dma_base_resource.start = dma_bar_phys_addr;
@@ -421,7 +421,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
pcard->sysinfo_regs_base = pcard->regs_bar_base;
err = read_system_regs(pcard);
if (err)
- goto out6;
+ goto err_unmap_dma;
// Disable all "user" interrupts because they're not used yet.
writeq(0xFFFFFFFFFFFFFFFF,
@@ -461,7 +461,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err) {
dev_err(&pcard->pdev->dev,
"CANNOT use DMA mask %0llx\n", DMA_BIT_MASK(64));
- goto out7;
+ goto err_unmap_dma;
}
dev_dbg(&pcard->pdev->dev,
"Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard)));
@@ -471,14 +471,14 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
*/
err = pci_enable_msi(pcard->pdev);
if (err < 0)
- goto out8a;
+ goto err_unmap_dma;
rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
pcard->name, pcard);
if (rv) {
dev_err(&pcard->pdev->dev,
"%s: failed to request_irq: %d\n", __func__, rv);
- goto out8b;
+ goto err_disable_msi;
}
/*
@@ -487,7 +487,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
err = sysfs_create_files(&pdev->dev.kobj, kp_attr_list);
if (err) {
dev_err(&pdev->dev, "Failed to add sysfs files: %d\n", err);
- goto out9;
+ goto err_free_irq;
}
/*
@@ -495,7 +495,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
*/
err = kp2000_probe_cores(pcard);
if (err)
- goto out10;
+ goto err_remove_sysfs;
/*
* Step 11: Enable IRQs in HW
@@ -506,28 +506,26 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
mutex_unlock(&pcard->sem);
return 0;
-out10:
+err_remove_sysfs:
sysfs_remove_files(&pdev->dev.kobj, kp_attr_list);
-out9:
+err_free_irq:
free_irq(pcard->pdev->irq, pcard);
-out8b:
+err_disable_msi:
pci_disable_msi(pcard->pdev);
-out8a:
-out7:
-out6:
+err_unmap_dma:
iounmap(pcard->dma_bar_base);
pci_release_region(pdev, DMA_BAR);
pcard->dma_bar_base = NULL;
-out5:
+err_unmap_regs:
iounmap(pcard->regs_bar_base);
pci_release_region(pdev, REG_BAR);
pcard->regs_bar_base = NULL;
-out4:
+err_disable_device:
pci_disable_device(pcard->pdev);
-out3:
+err_remove_ida:
mutex_unlock(&pcard->sem);
ida_simple_remove(&card_num_ida, pcard->card_num);
-out2:
+err_free_pcard:
kfree(pcard);
return err;
}
--
2.20.1
next prev parent reply other threads:[~2019-06-10 20:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 20:05 [PATCH 0/2] staging: kpc2000: minor fixes in kp2000_pcie_probe Simon Sandström
2019-06-10 20:05 ` Simon Sandström [this message]
2019-06-12 7:37 ` [PATCH 1/2] staging: kpc2000: improve label names " Dan Carpenter
2019-06-10 20:05 ` [PATCH 2/2] staging: kpc2000: remove unnecessary comments " Simon Sandström
2019-06-12 7:39 ` Dan Carpenter
2019-06-12 7:46 ` Greg KH
2019-06-12 10:07 ` Simon Sandström
2019-06-12 13:58 ` [PATCH v2 0/2] staging: kpc2000: minor fixes " Simon Sandström
2019-06-12 13:58 ` [PATCH v2 1/2] staging: kpc2000: improve label names " Simon Sandström
2019-06-12 13:58 ` [PATCH v2 2/2] staging: kpc2000: remove unnecessary comments " Simon Sandström
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=20190610200535.31820-2-simon@nikanor.nu \
--to=simon@nikanor.nu \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jeremy@azazel.net \
--cc=linux-kernel@vger.kernel.org \
/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).