[PATCH] pinctrl: cirrus: cs42l43: Fix double-put in cs42l43_pin_probe()

Felix Gu posted 1 patch 1 month, 3 weeks ago
drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] pinctrl: cirrus: cs42l43: Fix double-put in cs42l43_pin_probe()
Posted by Felix Gu 1 month, 3 weeks ago
devm_add_action_or_reset() already invokes the action on failure,
so the explicit put causes a double-put.

Fixes: 9b07cdf86a0b ("pinctrl: cirrus: Fix fwnode leak in cs42l43_pin_probe()")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index a8f82104a384..227c37c360e1 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -574,10 +574,9 @@ static int cs42l43_pin_probe(struct platform_device *pdev)
 		if (child) {
 			ret = devm_add_action_or_reset(&pdev->dev,
 				cs42l43_fwnode_put, child);
-			if (ret) {
-				fwnode_handle_put(child);
+			if (ret)
 				return ret;
-			}
+
 			if (!child->dev)
 				child->dev = priv->dev;
 			fwnode = child;

---
base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260223-cs42-1244548516b0

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>
Re: [PATCH] pinctrl: cirrus: cs42l43: Fix double-put in cs42l43_pin_probe()
Posted by Linus Walleij 1 month, 3 weeks ago
On Mon, Feb 23, 2026 at 10:39 AM Felix Gu <ustc.gu@gmail.com> wrote:

> devm_add_action_or_reset() already invokes the action on failure,
> so the explicit put causes a double-put.
>
> Fixes: 9b07cdf86a0b ("pinctrl: cirrus: Fix fwnode leak in cs42l43_pin_probe()")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Patch applied for fixes!

Yours,
Linus Walleij
Re: [PATCH] pinctrl: cirrus: cs42l43: Fix double-put in cs42l43_pin_probe()
Posted by Charles Keepax 1 month, 3 weeks ago
On Mon, Feb 23, 2026 at 05:39:07PM +0800, Felix Gu wrote:
> devm_add_action_or_reset() already invokes the action on failure,
> so the explicit put causes a double-put.
> 
> Fixes: 9b07cdf86a0b ("pinctrl: cirrus: Fix fwnode leak in cs42l43_pin_probe()")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles