PCI: Free resource files in error path of pci_create_sysfs_dev_files()
authorMichael Ellerman <michael@ellerman.id.au>
Wed, 18 Apr 2007 03:34:12 +0000 (13:34 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 3 May 2007 02:02:43 +0000 (19:02 -0700)
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 <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pci-sysfs.c

index 29676fe4f23e17a4962daee1bd04d76ffd36d9bc..284e83a527f9d4564c916597f6d65b21b2cff08c 100644 (file)
@@ -636,7 +636,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
                                goto err_rom;
                } else {
                        retval = -ENOMEM;
-                       goto err_bin_file;
+                       goto err_resource_files;
                }
        }
        /* add platform-specific attributes */
@@ -646,6 +646,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 
 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);