From: thor.thayer@linux.intel.com
To: Huang Zijiang <huang.zijiang@zte.com.cn>
Cc: bp@alien8.de, mchehab@kernel.org, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn
Subject: EDAC, altera: Add missing of_node_put()
Date: Thu, 14 Feb 2019 10:15:20 -0600 [thread overview]
Message-ID: <64c210a5-41d2-2f62-e3d5-ac9c14841858@linux.intel.com> (raw)
Hi,
On 2/14/19 12:39 AM, Huang Zijiang wrote:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented here after the last
> usage.
>
> Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
> ---
> drivers/edac/altera_edac.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index c89d82a..1bcd778 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -1046,14 +1046,17 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
> return -ENODEV;
> }
>
> - if (of_address_to_resource(sysmgr_np, 0, &res))
> + if (of_address_to_resource(sysmgr_np, 0, &res)) {
> + of_node_put(sysmgr_np);
> return -ENOMEM;
> + }
>
> /* Need physical address for SMCC call */
> base = res.start;
>
> ecc_mgr_map = regmap_init(NULL, NULL, (void *)base,
> &s10_sdram_regmap_cfg);
> + of_node_put(sysmgr_np);
> }
> of_node_put(np_eccmgr);
> if (IS_ERR(ecc_mgr_map)) {
>
Yes, I missed the error path. I mistakingly thought
of_node_put(np_eccmgr) would catch the exit of both branches but I
declared sysmgr_np instead of re-using np_eccmgr. I'll clean that up in
a separate patch (actually this code will disappear when my combined
sysmgr patchset is accepted upstream).
Thanks!
Reviewed-by: Thor Thayer <thor.thayer@linux.intel.com>
next reply other threads:[~2019-02-14 16:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 16:15 thor.thayer [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-02-15 13:00 EDAC, altera: Add missing of_node_put() Borislav Petkov
2019-02-14 6:39 Huang Zijiang
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=64c210a5-41d2-2f62-e3d5-ac9c14841858@linux.intel.com \
--to=thor.thayer@linux.intel.com \
--cc=bp@alien8.de \
--cc=huang.zijiang@zte.com.cn \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=wang.yi59@zte.com.cn \
/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