Skip to content

Commit

Permalink
PCI: Free resource files in error path of pci_create_sysfs_dev_files()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Ellerman authored and Greg Kroah-Hartman committed May 3, 2007
1 parent c0affe9 commit 9890b12
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down

0 comments on commit 9890b12

Please sign in to comment.