mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Vinod Koul <vkoul@kernel.org>,
	 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] dmaengine: mv_xor: fix child node refcount handling in early exit
Date: Fri, 11 Oct 2024 22:57:59 +0200	[thread overview]
Message-ID: <20241011-dma_mv_xor_of_node_put-v1-1-3c2de819f463@gmail.com> (raw)
In-Reply-To: <20241011-dma_mv_xor_of_node_put-v1-0-3c2de819f463@gmail.com>

The for_each_child_of_node() loop requires explicit calls to
of_node_put() to decrement the child's refcount upon early exits (break,
goto, return).

Add the missing calls in the two early exits before the goto
instructions.

Cc: stable@vger.kernel.org
Fixes: f7d12ef53ddf ("dma: mv_xor: add Device Tree binding")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/dma/mv_xor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 43efce77bb57..40b76b40bc30 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1388,6 +1388,7 @@ static int mv_xor_probe(struct platform_device *pdev)
 			irq = irq_of_parse_and_map(np, 0);
 			if (!irq) {
 				ret = -ENODEV;
+				of_node_put(np);
 				goto err_channel_add;
 			}
 
@@ -1396,6 +1397,7 @@ static int mv_xor_probe(struct platform_device *pdev)
 			if (IS_ERR(chan)) {
 				ret = PTR_ERR(chan);
 				irq_dispose_mapping(irq);
+				of_node_put(np);
 				goto err_channel_add;
 			}
 

-- 
2.43.0


  reply	other threads:[~2024-10-11 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 20:57 [PATCH 0/2] dmaengine: mv_xor: fix child node handling and switch to scoped loop Javier Carrasco
2024-10-11 20:57 ` Javier Carrasco [this message]
2024-10-11 20:58 ` [PATCH 2/2] dmaengine: mv_xor: switch to for_each_child_of_node_scoped() Javier Carrasco
2024-12-24 10:42 ` (subset) [PATCH 0/2] dmaengine: mv_xor: fix child node handling and switch to scoped loop Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011-dma_mv_xor_of_node_put-v1-1-3c2de819f463@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®