PCI/portdrv: Add put_device() after device_register() failure
authorLevente Kurusa <levex@linux.com>
Thu, 19 Dec 2013 21:22:35 +0000 (14:22 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 19 Dec 2013 22:02:54 +0000 (15:02 -0700)
This is required so that we give up the last reference to the device.
Removed the kfree() as put_device will result in release_pcie_device()
being called and hence the container of the device will be kfree'd.

[bhelgaas: fix conflict after my previous cleanup]
Signed-off-by: Levente Kurusa <levex@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/portdrv_core.c

index fc86d323feccfd5a96b464a0fc165dfd641e249b..9811eea535113507c310bed9b8317ba1c15f60b4 100644 (file)
@@ -345,7 +345,7 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
 
        retval = device_register(device);
        if (retval) {
-               kfree(pcie);
+               put_device(device);
                return retval;
        }