Commit c5c158f5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] cciss: intialisation oops fix

From: mikem@beardog.cca.cpqcorp.net

This patch moves the check of the controller to before trying to enable it.
If a controller is disabled the system will Oops without this fix.  This in
the 2.4 tree.
parent 5a848d7d
...@@ -2130,6 +2130,15 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) ...@@ -2130,6 +2130,15 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
__u64 cfg_base_addr_index; __u64 cfg_base_addr_index;
int i; int i;
/* check to see if controller has been disabled */
/* BEFORE trying to enable it */
(void) pci_read_config_word(pdev, PCI_COMMAND,&command);
if(!(command & 0x02))
{
printk(KERN_WARNING "cciss: controller appears to be disabled\n");
return(-1);
}
if (pci_enable_device(pdev)) if (pci_enable_device(pdev))
{ {
printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); printk(KERN_ERR "cciss: Unable to Enable PCI device\n");
...@@ -2145,7 +2154,6 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) ...@@ -2145,7 +2154,6 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
device_id = pdev->device; device_id = pdev->device;
irq = pdev->irq; irq = pdev->irq;
(void) pci_read_config_word(pdev, PCI_COMMAND,&command);
(void) pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); (void) pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
(void) pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, (void) pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,
&cache_line_size); &cache_line_size);
...@@ -2154,13 +2162,6 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) ...@@ -2154,13 +2162,6 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
(void) pci_read_config_dword(pdev, PCI_SUBSYSTEM_VENDOR_ID, (void) pci_read_config_dword(pdev, PCI_SUBSYSTEM_VENDOR_ID,
&board_id); &board_id);
/* check to see if controller has been disabled */
if(!(command & 0x02))
{
printk(KERN_WARNING "cciss: controller appears to be disabled\n");
return(-1);
}
/* search for our IO range so we can protect it */ /* search for our IO range so we can protect it */
for(i=0; i<DEVICE_COUNT_RESOURCE; i++) for(i=0; i<DEVICE_COUNT_RESOURCE; i++)
{ {
......
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