+ cciss-disable-device-when-returning-failure.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     CCISS: disable device when returning failure

has been added to the -mm tree.  Its filename is

     cciss-disable-device-when-returning-failure.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: CCISS: disable device when returning failure
From: Bjorn Helgaas <bjorn.helgaas@xxxxxx>


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@xxxxxx>
Acked-by: Jeff Garzik <jeff@xxxxxxxxxx>
Acked-by: Mike Miller <mike.miller@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/block/cciss.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff -puN drivers/block/cciss.c~cciss-disable-device-when-returning-failure drivers/block/cciss.c
--- 25/drivers/block/cciss.c~cciss-disable-device-when-returning-failure	Mon Jun 19 16:45:49 2006
+++ 25-akpm/drivers/block/cciss.c	Mon Jun 19 16:45:49 2006
@@ -2744,7 +2744,7 @@ static int cciss_pci_init(ctlr_info_t *c
 	__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 @@ static int cciss_pci_init(ctlr_info_t *c
 	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 @@ static int cciss_pci_init(ctlr_info_t *c
 	}
 	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 @@ static int cciss_pci_init(ctlr_info_t *c
 	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 @@ static int cciss_pci_init(ctlr_info_t *c
 		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 @@ static int cciss_pci_init(ctlr_info_t *c
 	      (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 @@ static int cciss_pci_init(ctlr_info_t *c
 	{
 		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;
 }
 
 /* 
_

Patches currently in -mm which might be from bjorn.helgaas@xxxxxx are

git-acpi.patch
acpi-update-asus_acpi-driver-registration-fix.patch
pnpacpi-reject-acpi_producer-resources.patch
2.6-sony_acpi4.patch
git-ia64.patch
git-klibc.patch
e100-disable-interrupts-at-boot.patch
vgacon-make-vga_map_mem-take-size-remove-extra-use.patch
cciss-disable-device-when-returning-failure.patch
cciss-request-all-pci-resources.patch
cciss-announce-cciss%d-devices-with-pci-address-irq-dac-info.patch
cciss-use-array_size-without-intermediates.patch
cciss-fix-a-few-spelling-errors.patch
cciss-remove-parens-around-return-values.patch
cciss-run-through-lindent.patch
cciss-tidy-up-product-table-indentation.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux