{
static int first_time = 1;
ucchar cpc_rev_id;
- int err = 0, eeprom_outdated = 0;
+ int err, eeprom_outdated = 0;
ucshort device_id;
pc300_t *card;
#endif
}
+ if ((err = pci_enable_device(pdev)) < 0)
+ return err;
+
card = (pc300_t *) kmalloc(sizeof(pc300_t), GFP_KERNEL);
if (card == NULL) {
printk("PC300 found at RAM 0x%08lx, "
"but could not allocate card structure.\n",
pci_resource_start(pdev, 3));
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_disable_dev;
}
memset(card, 0, sizeof(pc300_t));
+ err = -ENODEV;
+
/* read PCI configuration area */
device_id = ent->device;
card->hw.irq = pdev->irq;
printk("PC300 found at RAM 0x%08x, "
"but could not allocate PLX mem region.\n",
card->hw.ramphys);
- err = -ENODEV;
goto err_release_io;
}
if (!request_mem_region(card->hw.ramphys, card->hw.alloc_ramsize,
printk("PC300 found at RAM 0x%08x, "
"but could not allocate RAM mem region.\n",
card->hw.ramphys);
- err = -ENODEV;
goto err_release_plx;
}
if (!request_mem_region(card->hw.scaphys, card->hw.scasize,
printk("PC300 found at RAM 0x%08x, "
"but could not allocate SCA mem region.\n",
card->hw.ramphys);
- err = -ENODEV;
goto err_release_ram;
}
- if ((err = pci_enable_device(pdev)) != 0)
- goto err_release_sca;
-
card->hw.plxbase = ioremap(card->hw.plxphys, card->hw.plxsize);
card->hw.rambase = ioremap(card->hw.ramphys, card->hw.alloc_ramsize);
card->hw.scabase = ioremap(card->hw.scaphys, card->hw.scasize);
iounmap(card->hw.falcbase);
release_mem_region(card->hw.falcphys, card->hw.falcsize);
}
-err_release_sca:
release_mem_region(card->hw.scaphys, card->hw.scasize);
err_release_ram:
release_mem_region(card->hw.ramphys, card->hw.alloc_ramsize);
err_release_io:
release_region(card->hw.iophys, card->hw.iosize);
kfree(card);
- return -ENODEV;
+err_disable_dev:
+ pci_disable_device(pdev);
+ return err;
}
static void __devexit cpc_remove_one(struct pci_dev *pdev)
if (card->hw.irq)
free_irq(card->hw.irq, card);
kfree(card);
+ pci_disable_device(pdev);
}
}