From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nicholas Mc Guire <hofrat@osadl.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Nathan Chancellor <natechancellor@gmail.com>,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH] staging: board: drop refcount in success case
Date: Tue, 19 Jun 2018 10:37:09 +0300 [thread overview]
Message-ID: <20180619073709.schatjhjoitfc3fs@mwanda> (raw)
In-Reply-To: <1529347999-9316-1-git-send-email-hofrat@osadl.org>
On Mon, Jun 18, 2018 at 08:53:19PM +0200, Nicholas Mc Guire wrote:
> 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);
I don't feel like this is the right thing... We should keep the
reference until we're done with it. Which apparently is never?
But I don't know the code at all so I could be wrong.
regards,
dan carpenter
next prev parent reply other threads:[~2018-06-19 7:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 18:53 [PATCH] staging: board: drop refcount in success case Nicholas Mc Guire
2018-06-19 7:37 ` Dan Carpenter [this message]
2018-06-19 7:51 ` Geert Uytterhoeven
2018-06-19 8:08 ` Nicholas Mc Guire
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=20180619073709.schatjhjoitfc3fs@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=hofrat@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.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