From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 1/7] CCISS: disable device when returning failure
Date: Wed, 14 Jun 2006 17:08:33 -0600 [thread overview]
Message-ID: <200606141708.33625.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200606141707.27404.bjorn.helgaas@hp.com>
If something fails after we call pci_enable_device(), we should call
pci_disable_device() before returning the failure.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: rc5-mm3/drivers/block/cciss.c
===================================================================
--- rc5-mm3.orig/drivers/block/cciss.c 2006-06-14 14:29:40.000000000 -0600
+++ rc5-mm3/drivers/block/cciss.c 2006-06-14 14:36:03.000000000 -0600
@@ -2744,7 +2744,7 @@
__u64 cfg_offset;
__u32 cfg_base_addr;
__u64 cfg_base_addr_index;
- int i;
+ int i, err;
/* check to see if controller has been disabled */
/* BEFORE trying to enable it */
@@ -2752,13 +2752,14 @@
if(!(command & 0x02))
{
printk(KERN_WARNING "cciss: controller appears to be disabled\n");
- return(-1);
+ return -ENODEV;
}
- if (pci_enable_device(pdev))
+ err = pci_enable_device(pdev);
+ if (err)
{
printk(KERN_ERR "cciss: Unable to Enable PCI device\n");
- return( -1);
+ return err;
}
subsystem_vendor_id = pdev->subsystem_vendor;
@@ -2824,7 +2825,8 @@
}
if (scratchpad != CCISS_FIRMWARE_READY) {
printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
- return -1;
+ err = -ENODEV;
+ goto err_out_disable_pdev;
}
/* get the address index number */
@@ -2841,7 +2843,8 @@
if (cfg_base_addr_index == -1) {
printk(KERN_WARNING "cciss: Cannot find cfg_base_addr_index\n");
release_io_mem(c);
- return -1;
+ err = -ENODEV;
+ goto err_out_disable_pdev;
}
cfg_offset = readl(c->vaddr + SA5_CTMEM_OFFSET);
@@ -2868,7 +2871,8 @@
printk(KERN_WARNING "cciss: Sorry, I don't know how"
" to access the Smart Array controller %08lx\n",
(unsigned long)board_id);
- return -1;
+ err = -ENODEV;
+ goto err_out_disable_pdev;
}
if ( (readb(&c->cfgtable->Signature[0]) != 'C') ||
(readb(&c->cfgtable->Signature[1]) != 'I') ||
@@ -2876,7 +2880,8 @@
(readb(&c->cfgtable->Signature[3]) != 'S') )
{
printk("Does not appear to be a valid CISS config table\n");
- return -1;
+ err = -ENODEV;
+ goto err_out_disable_pdev;
}
#ifdef CONFIG_X86
@@ -2920,10 +2925,14 @@
{
printk(KERN_WARNING "cciss: unable to get board into"
" simple mode\n");
- return -1;
+ err = -ENODEV;
+ goto err_out_disable_pdev;
}
return 0;
+err_out_disable_pdev:
+ pci_disable_device(pdev);
+ return err;
}
/*
next prev parent reply other threads:[~2006-06-14 23:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-14 23:07 [PATCH 0/7] CCISS cleanups Bjorn Helgaas
2006-06-14 23:08 ` Bjorn Helgaas [this message]
2006-06-14 23:36 ` [PATCH 1/7] CCISS: disable device when returning failure Jeff Garzik
2006-06-15 14:32 ` Miller, Mike (OS Dev)
2006-06-14 23:09 ` [PATCH 2/7] CCISS: request all PCI resources Bjorn Helgaas
2006-06-15 14:35 ` Miller, Mike (OS Dev)
2006-06-14 23:10 ` [PATCH 3/7] CCISS: announce cciss%d devices with PCI address/IRQ/DAC info Bjorn Helgaas
2006-06-14 23:37 ` Jeff Garzik
2006-06-15 14:37 ` Miller, Mike (OS Dev)
2006-06-14 23:10 ` [PATCH 4/7] CCISS: use ARRAY_SIZE without intermediates Bjorn Helgaas
2006-06-14 23:37 ` Jeff Garzik
2006-06-15 14:38 ` Miller, Mike (OS Dev)
2006-06-14 23:11 ` [PATCH 5/7] CCISS: fix a few spelling errors Bjorn Helgaas
2006-06-15 14:40 ` Miller, Mike (OS Dev)
2006-06-14 23:12 ` [PATCH 6/7] CCISS: remove parens around return values Bjorn Helgaas
2006-06-15 14:42 ` Miller, Mike (OS Dev)
[not found] ` <200606141713.46497.bjorn.helgaas@hp.com>
2006-06-15 4:08 ` [PATCH 7/7] CCISS: run through Lindent Bjorn Helgaas
[not found] ` <c6b285c60606150114h273f5ceue19bcea43937e86c@mail.gmail.com>
2006-06-15 8:35 ` [PATCH 0/7] CCISS cleanups Laura Garcia
2006-06-15 11:50 ` Jeff Garzik
2006-06-15 16:57 ` [PATCH 8/7] CCISS: tidy up product table indentation Bjorn Helgaas
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=200606141708.33625.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=akpm@osdl.org \
--cc=iss_storagedev@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.miller@hp.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
all inboxes | Powered by JetHome®