netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Liang He <windhl@126.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2] net: ftgmac100: Hold reference returned by of_get_child_by_name()
Date: Mon, 11 Jul 2022 19:58:07 -0700	[thread overview]
Message-ID: <20220711195807.4f4749ef@kernel.org> (raw)
In-Reply-To: <20220710020728.317086-1-windhl@126.com>

On Sun, 10 Jul 2022 10:07:28 +0800 Liang He wrote:
> +static inline struct device_node *ftgmac100_has_child_node(struct device_node *np, const char *name)
> +{
> +	struct device_node *child_np = of_get_child_by_name(np, "mdio");
> +
> +	of_node_put(child_np);
> +
> +	return child_np;

Could you make the return type bool ? We don't have a reference on 
the child_no node, we should probably not return the pointer.

Also the "inline" keyword is unnecessary the compiler will inline 
a small, static function with a single caller, anyway.

  reply	other threads:[~2022-07-12  2:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10  2:07 [PATCH v2] net: ftgmac100: Hold reference returned by of_get_child_by_name() Liang He
2022-07-12  2:58 ` Jakub Kicinski [this message]
2022-07-12  5:51   ` 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=20220711195807.4f4749ef@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).