|
@@ -566,6 +566,11 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
|
|
|
|
|
|
lynx->registers = ioremap_nocache(pci_resource_start(dev, 0),
|
|
lynx->registers = ioremap_nocache(pci_resource_start(dev, 0),
|
|
PCILYNX_MAX_REGISTER);
|
|
PCILYNX_MAX_REGISTER);
|
|
|
|
+ if (lynx->registers == NULL) {
|
|
|
|
+ dev_err(&dev->dev, "Failed to map registers\n");
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ goto fail_deallocate_lynx;
|
|
|
|
+ }
|
|
|
|
|
|
lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device,
|
|
lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device,
|
|
sizeof(struct pcl), &lynx->rcv_start_pcl_bus);
|
|
sizeof(struct pcl), &lynx->rcv_start_pcl_bus);
|
|
@@ -578,7 +583,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
|
|
lynx->rcv_buffer == NULL) {
|
|
lynx->rcv_buffer == NULL) {
|
|
dev_err(&dev->dev, "Failed to allocate receive buffer\n");
|
|
dev_err(&dev->dev, "Failed to allocate receive buffer\n");
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
- goto fail_deallocate;
|
|
|
|
|
|
+ goto fail_deallocate_buffers;
|
|
}
|
|
}
|
|
lynx->rcv_start_pcl->next = cpu_to_le32(lynx->rcv_pcl_bus);
|
|
lynx->rcv_start_pcl->next = cpu_to_le32(lynx->rcv_pcl_bus);
|
|
lynx->rcv_pcl->next = cpu_to_le32(PCL_NEXT_INVALID);
|
|
lynx->rcv_pcl->next = cpu_to_le32(PCL_NEXT_INVALID);
|
|
@@ -641,7 +646,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
|
|
dev_err(&dev->dev,
|
|
dev_err(&dev->dev,
|
|
"Failed to allocate shared interrupt %d\n", dev->irq);
|
|
"Failed to allocate shared interrupt %d\n", dev->irq);
|
|
ret = -EIO;
|
|
ret = -EIO;
|
|
- goto fail_deallocate;
|
|
|
|
|
|
+ goto fail_deallocate_buffers;
|
|
}
|
|
}
|
|
|
|
|
|
lynx->misc.parent = &dev->dev;
|
|
lynx->misc.parent = &dev->dev;
|
|
@@ -668,7 +673,7 @@ fail_free_irq:
|
|
reg_write(lynx, PCI_INT_ENABLE, 0);
|
|
reg_write(lynx, PCI_INT_ENABLE, 0);
|
|
free_irq(lynx->pci_device->irq, lynx);
|
|
free_irq(lynx->pci_device->irq, lynx);
|
|
|
|
|
|
-fail_deallocate:
|
|
|
|
|
|
+fail_deallocate_buffers:
|
|
if (lynx->rcv_start_pcl)
|
|
if (lynx->rcv_start_pcl)
|
|
pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
|
|
pci_free_consistent(lynx->pci_device, sizeof(struct pcl),
|
|
lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
|
|
lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
|
|
@@ -679,6 +684,8 @@ fail_deallocate:
|
|
pci_free_consistent(lynx->pci_device, PAGE_SIZE,
|
|
pci_free_consistent(lynx->pci_device, PAGE_SIZE,
|
|
lynx->rcv_buffer, lynx->rcv_buffer_bus);
|
|
lynx->rcv_buffer, lynx->rcv_buffer_bus);
|
|
iounmap(lynx->registers);
|
|
iounmap(lynx->registers);
|
|
|
|
+
|
|
|
|
+fail_deallocate_lynx:
|
|
kfree(lynx);
|
|
kfree(lynx);
|
|
|
|
|
|
fail_disable:
|
|
fail_disable:
|