lkml.org 
[lkml]   [2018]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: board: drop refcount in success case
Date
 The call to of_find_compatible_node() returns irqc_node with refcount
incremented thus it must be explicitly decremented here after it was
checked for non-NULL.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit 72ee8626eeb1 ("staging: board: Add support for translating hwirq to virq numbers")
---

Problem located with an experimental coccinelle script

Patch was compile-tested with: x86_64_defconfig + STAGING=y, STAGING_BOARD=y

Patch is against 4.18-rc1 (localversion-next is next-20180618)

drivers/staging/board/board.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
index cb6feb3..8ee48e5 100644
--- a/drivers/staging/board/board.c
+++ b/drivers/staging/board/board.c
@@ -64,12 +64,13 @@ int __init board_staging_gic_setup_xlate(const char *gic_match,
irqc_node = of_find_compatible_node(NULL, NULL, gic_match);

WARN_ON(!irqc_node);
if (!irqc_node)
return -ENOENT;

+ of_node_put(irqc_node);
irqc_base = base;
return 0;
}

static void __init gic_fixup_resource(struct resource *res)
{
--
2.1.4
\
 
 \ /
  Last update: 2018-06-18 20:57    [W:2.048 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site