@@ -118,11 +118,15 @@ static int atir_pci_probe(struct pci_dev *pdev,
dev_info(&pdev->dev, "memory at 0x%08llX\n",
(unsigned long long)pci_addr_phys);
+ rc = pci_enable_device_mem(pdev);
+ if (rc)
+ goto err_free;
+
atir->pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF, 0x400);
if (atir->pci_addr_lin == 0) {
dev_err(&pdev->dev, "pci mem must be mapped\n");
rc = -ENODEV;
- goto err_free;
+ goto err_disable;
}
strcpy(atir->driver.name, "ATIR");
@@ -148,6 +152,8 @@ static int atir_pci_probe(struct pci_dev *pdev,
err_unmap:
iounmap(atir->pci_addr_lin);
+err_disable:
+ pci_disable_device(pdev);
err_free:
pci_set_drvdata(pdev, NULL);
kfree(atir);
@@ -161,6 +167,7 @@ static void atir_pci_remove(struct pci_dev *pdev)
lirc_unregister_driver(atir->minor);
iounmap(atir->pci_addr_lin);
+ pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
kfree(atir);
}
We must not assume that the PCI device is already enabled. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- drivers/staging/media/lirc/lirc_bt829.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)