]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: mvebu: Use devm_add_action_or_reset() instead of devm_add_action()
authorSalah Triki <salah.triki@gmail.com>
Sat, 19 Jul 2025 04:34:40 +0000 (05:34 +0100)
committerManivannan Sadhasivam <mani@kernel.org>
Wed, 23 Jul 2025 16:32:50 +0000 (22:02 +0530)
Replace devm_add_action() with devm_add_action_or_reset() to avoid
explicitly dropping the 'port->clk' reference in error path.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
[mani: reworded commit subject and description]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/aHsgYALHfQbrgq0t@pc
drivers/pci/controller/pci-mvebu.c

index a4a2bac4f4b279c818ec6e68e8497294ea56e2cc..755651f33811d7daf277247e29a5741cedeec8d0 100644 (file)
@@ -1353,11 +1353,9 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
                goto skip;
        }
 
-       ret = devm_add_action(dev, mvebu_pcie_port_clk_put, port);
-       if (ret < 0) {
-               clk_put(port->clk);
+       ret = devm_add_action_or_reset(dev, mvebu_pcie_port_clk_put, port);
+       if (ret < 0)
                goto err;
-       }
 
        return 1;