All of lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor.dooley@microchip.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: <linux-riscv@lists.infradead.org>, <yash.shah@sifive.com>,
	<palmer@dabbelt.com>, <paul.walmsley@sifive.com>,
	<conor@kernel.org>
Subject: Re: [PATCH v2 3/3] soc: sifive: ccache: fix missing of_node_put() in sifive_ccache_init()
Date: Tue, 18 Oct 2022 08:40:56 +0100	[thread overview]
Message-ID: <Y05YiMEaXu4jFtWR@wendy> (raw)
In-Reply-To: <20221018023149.1048176-4-yangyingliang@huawei.com>

On Tue, Oct 18, 2022 at 10:31:49AM +0800, Yang Yingliang wrote:
> The device_node pointer returned by of_find_matching_node() with
> refcount incremented, when finish using it, the refcount need be
> decreased.

Cool, patch looks about as I'd expect. Thanks!
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

> 
> Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/soc/sifive/sifive_ccache.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c
> index 98269d056728..3684f5b40a80 100644
> --- a/drivers/soc/sifive/sifive_ccache.c
> +++ b/drivers/soc/sifive/sifive_ccache.c
> @@ -215,12 +215,16 @@ static int __init sifive_ccache_init(void)
>  	if (!np)
>  		return -ENODEV;
>  
> -	if (of_address_to_resource(np, 0, &res))
> -		return -ENODEV;
> +	if (of_address_to_resource(np, 0, &res)) {
> +		rc = -ENODEV;
> +		goto err_node_put;
> +	}
>  
>  	ccache_base = ioremap(res.start, resource_size(&res));
> -	if (!ccache_base)
> -		return -ENOMEM;
> +	if (!ccache_base) {
> +		rc = -ENOMEM;
> +		goto err_node_put;
> +	}
>  
>  	if (of_property_read_u32(np, "cache-level", &level)) {
>  		rc = -ENOENT;
> @@ -243,6 +247,7 @@ static int __init sifive_ccache_init(void)
>  			goto err_free_irq;
>  		}
>  	}
> +	of_node_put(np);
>  
>  	ccache_config_read();
>  
> @@ -259,6 +264,8 @@ static int __init sifive_ccache_init(void)
>  		free_irq(g_irq[i], NULL);
>  err_unmap:
>  	iounmap(ccache_base);
> +err_node_put:
> +	of_node_put(np);
>  	return rc;
>  }
>  
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-10-18  7:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  2:31 [PATCH v2 0/3] some fixes for sifive_ccache Yang Yingliang
2022-10-18  2:31 ` [PATCH v2 1/3] soc: sifive: ccache: fix missing iounmap() in error path in sifive_ccache_init() Yang Yingliang
2022-10-18  2:31 ` [PATCH v2 2/3] soc: sifive: ccache: fix missing free_irq() " Yang Yingliang
2022-10-18  2:31 ` [PATCH v2 3/3] soc: sifive: ccache: fix missing of_node_put() " Yang Yingliang
2022-10-18  7:40   ` Conor Dooley [this message]
2022-10-18  7:35 ` [PATCH v2 0/3] some fixes for sifive_ccache Ben Dooks
2022-11-16 18:33 ` Conor Dooley

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=Y05YiMEaXu4jFtWR@wendy \
    --to=conor.dooley@microchip.com \
    --cc=conor@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=yangyingliang@huawei.com \
    --cc=yash.shah@sifive.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.