From: Lior Dotan <liodot@gmail.com>
To: gregkh@suse.de
Cc: Christopher Harrer <charrer@alacritech.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] SLICOSS - free resources on entry_probe error path
Date: Wed, 11 Feb 2009 12:18:21 +0200 [thread overview]
Message-ID: <4992A5ED.5050800@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
Call pci_disable_device() and free_netdev() if slic_entry_probe fails.
Signed_off-by: Lior Dotan <liodot@gmail.com>
[-- Attachment #2: slicoss-clean-slic_entry_probe.patch --]
[-- Type: text/plain, Size: 1832 bytes --]
diff -X /usr/src/linux/Documentation/dontdiff -purN a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
--- a/drivers/staging/slicoss/slicoss.c 2009-02-11 11:15:32.000000000 +0200
+++ b/drivers/staging/slicoss/slicoss.c 2009-02-11 12:03:42.000000000 +0200
@@ -335,7 +335,7 @@ static int __devinit slic_entry_probe(st
{
static int cards_found;
static int did_version;
- int err;
+ int err = -ENODEV;
struct net_device *netdev;
struct adapter *adapter;
void __iomem *memmapped_ioaddr = NULL;
@@ -369,7 +369,7 @@ static int __devinit slic_entry_probe(st
DBG_MSG
("No usable DMA configuration, aborting err[%x]\n",
err);
- return err;
+ goto err_out_disable_pci;
}
DBG_MSG("pci_set_dma_mask(DMA_32BIT_MASK) successful\n");
}
@@ -379,7 +379,7 @@ static int __devinit slic_entry_probe(st
err = pci_request_regions(pcidev, DRV_NAME);
if (err) {
DBG_MSG("pci_request_regions FAILED err[%x]\n", err);
- return err;
+ goto err_out_disable_pci;
}
DBG_MSG("call pci_set_master\n");
@@ -413,7 +413,7 @@ static int __devinit slic_entry_probe(st
if (!memmapped_ioaddr) {
DBG_ERROR("%s cannot remap MMIO region %lx @ %lx\n",
__func__, mmio_len, mmio_start);
- goto err_out_free_mmio_region;
+ goto err_out_free_netdev;
}
DBG_MSG
@@ -497,16 +497,17 @@ static int __devinit slic_entry_probe(st
err_out_unmap:
iounmap(memmapped_ioaddr);
-
err_out_free_mmio_region:
release_mem_region(mmio_start, mmio_len);
-
+err_out_free_netdev:
+ free_netdev(netdev);
err_out_exit_slic_probe:
pci_release_regions(pcidev);
DBG_ERROR("%s EXIT jiffies[%lx] cpu %d\n", __func__, jiffies,
smp_processor_id());
-
- return -ENODEV;
+err_out_disable_pci:
+ pci_disable_device(pcidev);
+ return err;
}
static int slic_entry_open(struct net_device *dev)
reply other threads:[~2009-02-11 10:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4992A5ED.5050800@gmail.com \
--to=liodot@gmail.com \
--cc=charrer@alacritech.com \
--cc=gregkh@suse.de \
--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