int result = -ENOMEM;
struct service_processor *sp;
+ if (pci_enable_device(pdev)) {
+ printk(KERN_ERR "%s: can't enable PCI device at %s\n",
+ DRIVER_NAME, pci_name(pdev));
+ return -ENODEV;
+ }
+
sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL);
if (sp == NULL) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
- return result;
+ result = -ENOMEM;
+ goto error_kmalloc;
}
memset(sp, 0, sizeof(struct service_processor));
ibmasm_event_buffer_exit(sp);
error_eventbuffer:
kfree(sp);
+error_kmalloc:
+ pci_disable_device(pdev);
return result;
}
iounmap(sp->base_address);
ibmasm_event_buffer_exit(sp);
kfree(sp);
+ pci_disable_device(pdev);
}
static struct pci_device_id ibmasm_pci_table[] =