From michael@ozlabs.org Wed Apr 18 12:37:58 2007 From: Michael Ellerman Date: Wed, 18 Apr 2007 13:34:12 +1000 Subject: PCI: Free resource files in error path of pci_create_sysfs_dev_files() To: Greg Kroah-Hartman Cc: linux-pci@atrey.karlin.mff.cuni.cz Message-ID: <20070418033435.0EDA8DDE33@ozlabs.org> pci_create_sysfs_dev_files() should call pci_remove_resource_files() in its error path, to match the call it makes to pci_create_resource_files(). Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -632,7 +632,7 @@ int __must_check pci_create_sysfs_dev_fi goto err_rom; } else { retval = -ENOMEM; - goto err_bin_file; + goto err_resource_files; } } /* add platform-specific attributes */ @@ -642,6 +642,8 @@ int __must_check pci_create_sysfs_dev_fi err_rom: kfree(rom_attr); +err_resource_files: + pci_remove_resource_files(pdev); err_bin_file: if (pdev->cfg_size < 4096) sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);