From: Levente Kurusa Date: Thu, 19 Dec 2013 21:22:35 +0000 (-0700) Subject: PCI/portdrv: Add put_device() after device_register() failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f39862058e1f278e0495cd9ea57de571e74aa1fe;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git PCI/portdrv: Add put_device() after device_register() failure 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 Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index fc86d323fecc..9811eea53511 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -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; }