mirror of https://github.com/torvalds/linux.git
PCI/pwrctrl: Fix double cleanup on devm_add_action_or_reset() failure
When devm_add_action_or_reset() fails, it calls the passed cleanup
function. Hence the caller must not repeat that cleanup.
Replace the "goto err_regulator_free" by the actual freeing, as there
will never be a need again for a second user of this label.
Fixes: 75996c92f4 ("PCI/pwrctrl: Add pwrctrl driver for PCI slots")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # V4H Sparrow Hawk
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://patch.msgid.link/7b1386e6162e70e6d631c87f6323d2ab971bc1c5.1755100324.git.geert+renesas@glider.be
This commit is contained in:
parent
8f5ae30d69
commit
ab81f2f79c
|
|
@ -49,13 +49,14 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
|
|||
ret = regulator_bulk_enable(slot->num_supplies, slot->supplies);
|
||||
if (ret < 0) {
|
||||
dev_err_probe(dev, ret, "Failed to enable slot regulators\n");
|
||||
goto err_regulator_free;
|
||||
regulator_bulk_free(slot->num_supplies, slot->supplies);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_power_off,
|
||||
slot);
|
||||
if (ret)
|
||||
goto err_regulator_disable;
|
||||
return ret;
|
||||
|
||||
clk = devm_clk_get_optional_enabled(dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
|
|
@ -70,13 +71,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
|
|||
return dev_err_probe(dev, ret, "Failed to register pwrctrl driver\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err_regulator_disable:
|
||||
regulator_bulk_disable(slot->num_supplies, slot->supplies);
|
||||
err_regulator_free:
|
||||
regulator_bulk_free(slot->num_supplies, slot->supplies);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id pci_pwrctrl_slot_of_match[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue