[PATCH] dmaengine: ppc4xx: Call of_node_put(np) only once in ppc440spe_adma_setup_irqs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
 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






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux