Commit 2bbf0339 authored by Jamie Lenehan's avatar Jamie Lenehan Committed by James Bottomley

[PATCH] SCSI dc395x.c: Call pci_disable during cleanup.

Call pci_disable_device if initialisation fails and during cleanup.
Signed-off-by: default avatarJamie Lenehan <lenehan@twibble.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 5e717ae7
...@@ -4792,8 +4792,8 @@ static void banner_display(void) ...@@ -4792,8 +4792,8 @@ static void banner_display(void)
static int __devinit dc395x_init_one(struct pci_dev *dev, static int __devinit dc395x_init_one(struct pci_dev *dev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
struct Scsi_Host *scsi_host; struct Scsi_Host *scsi_host = NULL;
struct AdapterCtlBlk *acb; struct AdapterCtlBlk *acb = NULL;
unsigned long io_port_base; unsigned long io_port_base;
unsigned int io_port_len; unsigned int io_port_len;
unsigned int irq; unsigned int irq;
...@@ -4816,7 +4816,7 @@ static int __devinit dc395x_init_one(struct pci_dev *dev, ...@@ -4816,7 +4816,7 @@ static int __devinit dc395x_init_one(struct pci_dev *dev,
sizeof(struct AdapterCtlBlk)); sizeof(struct AdapterCtlBlk));
if (!scsi_host) { if (!scsi_host) {
dprintkl(KERN_INFO, "scsi_host_alloc failed\n"); dprintkl(KERN_INFO, "scsi_host_alloc failed\n");
return -ENOMEM; goto fail;
} }
acb = (struct AdapterCtlBlk*)scsi_host->hostdata; acb = (struct AdapterCtlBlk*)scsi_host->hostdata;
acb->scsi_host = scsi_host; acb->scsi_host = scsi_host;
...@@ -4825,8 +4825,7 @@ static int __devinit dc395x_init_one(struct pci_dev *dev, ...@@ -4825,8 +4825,7 @@ static int __devinit dc395x_init_one(struct pci_dev *dev,
/* initialise the adapter and everything we need */ /* initialise the adapter and everything we need */
if (adapter_init(acb, io_port_base, io_port_len, irq)) { if (adapter_init(acb, io_port_base, io_port_len, irq)) {
dprintkl(KERN_INFO, "adapter init failed\n"); dprintkl(KERN_INFO, "adapter init failed\n");
scsi_host_put(scsi_host); goto fail;
return -ENODEV;
} }
pci_set_master(dev); pci_set_master(dev);
...@@ -4834,14 +4833,20 @@ static int __devinit dc395x_init_one(struct pci_dev *dev, ...@@ -4834,14 +4833,20 @@ static int __devinit dc395x_init_one(struct pci_dev *dev,
/* get the scsi mid level to scan for new devices on the bus */ /* get the scsi mid level to scan for new devices on the bus */
if (scsi_add_host(scsi_host, &dev->dev)) { if (scsi_add_host(scsi_host, &dev->dev)) {
dprintkl(KERN_ERR, "scsi_add_host failed\n"); dprintkl(KERN_ERR, "scsi_add_host failed\n");
adapter_uninit(acb); goto fail;
scsi_host_put(scsi_host);
return -ENODEV;
} }
pci_set_drvdata(dev, scsi_host); pci_set_drvdata(dev, scsi_host);
scsi_scan_host(scsi_host); scsi_scan_host(scsi_host);
return 0; return 0;
fail:
if (acb != NULL)
adapter_uninit(acb);
if (scsi_host != NULL)
scsi_host_put(scsi_host);
pci_disable_device(dev);
return -ENODEV;
} }
...@@ -4860,6 +4865,7 @@ static void __devexit dc395x_remove_one(struct pci_dev *dev) ...@@ -4860,6 +4865,7 @@ static void __devexit dc395x_remove_one(struct pci_dev *dev)
scsi_remove_host(scsi_host); scsi_remove_host(scsi_host);
adapter_uninit(acb); adapter_uninit(acb);
pci_disable_device(dev);
scsi_host_put(scsi_host); scsi_host_put(scsi_host);
pci_set_drvdata(dev, NULL); pci_set_drvdata(dev, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment