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 <levex@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>hifive-unleashed-5.1
parent
8f3acca9ac
commit
f39862058e
|
@ -345,7 +345,7 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
|
||||||
|
|
||||||
retval = device_register(device);
|
retval = device_register(device);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
kfree(pcie);
|
put_device(device);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue