aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pci/controller/pci-host-common.c
diff options
context:
space:
mode:
authorFuqian Huang <huangfq.daxian@gmail.com>2019-07-08 20:33:54 +0800
committerBjorn Helgaas <bhelgaas@google.com>2019-07-24 14:20:31 -0500
commitbefa45fb5bdd514a40a19e659491193f7fd022f2 (patch)
tree7f02f8a3fd9b954473326dce7ec314cd3bda6c10 /drivers/pci/controller/pci-host-common.c
parentLinus 5.3-rc1 (diff)
downloadwireguard-linux-befa45fb5bdd514a40a19e659491193f7fd022f2.tar.xz
wireguard-linux-befa45fb5bdd514a40a19e659491193f7fd022f2.zip
PCI: Use devm_add_action_or_reset()
devm_add_action_or_reset() is a helper function which internally calls devm_add_action(). If the devm_add_action() fails, it will execute the action mentioned and return the error code. Use devm_add_action_or_reset() to reduce source code size (avoid writing the action twice) and reduce the likelihood of bugs. Link: https://lore.kernel.org/r/20190708123354.12127-1-huangfq.daxian@gmail.com Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/controller/pci-host-common.c')
-rw-r--r--drivers/pci/controller/pci-host-common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index c742881b5061..c8cb9c5188a4 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -43,9 +43,8 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
goto err_out;
}
- err = devm_add_action(dev, gen_pci_unmap_cfg, cfg);
+ err = devm_add_action_or_reset(dev, gen_pci_unmap_cfg, cfg);
if (err) {
- gen_pci_unmap_cfg(cfg);
goto err_out;
}
return cfg;