All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Liang He <windhl@126.com>
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, windhl@126.com
Subject: Re: [PATCH] crypto: Hold the reference returned by of_find_compatible_node
Date: Thu, 30 Jun 2022 14:43:21 +0800	[thread overview]
Message-ID: <Yr1GCZF/gWBm4zHp@gondor.apana.org.au> (raw)
In-Reply-To: <20220621073742.4081013-1-windhl@126.com>

Liang He <windhl@126.com> wrote:
> In nx842_pseries_init() and crypto4xx_probe(), we should hold the
> reference returned by of_find_compatible_node() and use it to call
> of_node_put to keep refcount balance.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/crypto/amcc/crypto4xx_core.c  | 13 ++++++++-----
> drivers/crypto/nx/nx-common-pseries.c |  5 ++++-
> 2 files changed, 12 insertions(+), 6 deletions(-)

Please split this into two patches.

> diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
> index 8278d98074e9..169b6a05e752 100644
> --- a/drivers/crypto/amcc/crypto4xx_core.c
> +++ b/drivers/crypto/amcc/crypto4xx_core.c
> @@ -1378,6 +1378,7 @@ static int crypto4xx_probe(struct platform_device *ofdev)
>        struct resource res;
>        struct device *dev = &ofdev->dev;
>        struct crypto4xx_core_device *core_dev;
> +       struct device_node *np;
>        u32 pvr;
>        bool is_revb = true;
> 
> @@ -1385,20 +1386,20 @@ static int crypto4xx_probe(struct platform_device *ofdev)
>        if (rc)
>                return -ENODEV;
> 
> -       if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) {
> +       if ((np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) != NULL) {

This is getting awkwardly long.  Please change this to

	np = ...;
	if (np) {

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2022-06-30  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21  7:37 [PATCH] crypto: Hold the reference returned by of_find_compatible_node Liang He
2022-06-30  6:43 ` Herbert Xu [this message]
2022-06-30  6:46   ` Liang He

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=Yr1GCZF/gWBm4zHp@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=windhl@126.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.