[media] lirc_bt829: Enable and disable device
authorBen Hutchings <ben@decadent.org.uk>
Thu, 5 Sep 2013 01:32:19 +0000 (22:32 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 3 Oct 2013 17:05:32 +0000 (14:05 -0300)
We must not assume that the PCI device is already enabled.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/staging/media/lirc/lirc_bt829.c

index a61d233f38ca383ee576fc7f6d6c5f4eb44b70f8..623f10e2cdaa62399ce2061e7bc9e721189e7a73 100644 (file)
@@ -126,9 +126,13 @@ int init_module(void)
        if (pdev == NULL)
                return -ENODEV;
 
+       rc = pci_enable_device(pdev);
+       if (rc)
+               goto err_put_dev;
+
        if (!atir_init_start()) {
                rc = -ENODEV;
-               goto err_put_dev;
+               goto err_disable;
        }
 
        strcpy(atir_driver.name, "ATIR");
@@ -154,6 +158,8 @@ int init_module(void)
 
 err_unmap:
        iounmap(pci_addr_lin);
+err_disable:
+       pci_disable_device(pdev);
 err_put_dev:
        pci_dev_put(pdev);
        return rc;
@@ -166,6 +172,7 @@ void cleanup_module(void)
 
        lirc_unregister_driver(atir_minor);
        iounmap(pci_addr_lin);
+       pci_disable_device(pdev);
        pci_dev_put(pdev);
 }