mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: dmaengine@vger.kernel.org, Amit Vadhavana <av2082000@gmail.com>,
	Anatolij Gustschin <agust@denx.de>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Kees Cook <kees@kernel.org>,
	Vinod Koul <vkoul@kernel.org>, Yuri Tikhonov <yur@emcraft.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] dmaengine: ppc4xx: Call of_node_put(np) only once in ppc440spe_adma_setup_irqs()
Date: Thu, 3 Oct 2024 12:26:25 +0200	[thread overview]
Message-ID: <4f999e1b-9c10-453c-b68b-1495861d425c@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 3 Oct 2024 11:40:06 +0200

An of_node_put(np) call was immediately used after a null pointer check
for an of_iomap() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/dma/ppc4xx/adma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 7b78759ac734..25d5ec028d68 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -3938,13 +3938,13 @@ static int ppc440spe_adma_setup_irqs(struct ppc440spe_adma_device *adev,
 			goto err_req2;
 		}
 		adev->i2o_reg = of_iomap(np, 0);
+		of_node_put(np);
 		if (!adev->i2o_reg) {
 			pr_err("%s: failed to map I2O registers\n", __func__);
-			of_node_put(np);
 			ret = -EINVAL;
 			goto err_req2;
 		}
-		of_node_put(np);
+
 		/* Unmask 'CS FIFO Attention' interrupts and
 		 * enable generating interrupts on errors
 		 */
--
2.46.1


                 reply	other threads:[~2024-10-03 10:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4f999e1b-9c10-453c-b68b-1495861d425c@web.de \
    --to=markus.elfring@web.de \
    --cc=agust@denx.de \
    --cc=av2082000@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghua.yu@intel.com \
    --cc=kees@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yur@emcraft.com \
    /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®