From: Andrew Lunn <andrew@lunn.ch>
To: David Miller <davem@davemloft.net>
Cc: o.rempel@pengutronix.de, jcliburn@gmail.com,
chris.snook@gmail.com, kernel@pengutronix.de,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: ag71xx: fix mdio subnode support
Date: Tue, 1 Oct 2019 18:43:40 +0200 [thread overview]
Message-ID: <20191001164340.GC2031@lunn.ch> (raw)
In-Reply-To: <20191001.090320.1192378852987776883.davem@davemloft.net>
On Tue, Oct 01, 2019 at 09:03:20AM -0700, David Miller wrote:
> From: Oleksij Rempel <o.rempel@pengutronix.de>
> Date: Tue, 1 Oct 2019 08:41:47 +0200
>
> > @@ -571,7 +571,9 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
> > msleep(200);
> > }
> >
> > - err = of_mdiobus_register(mii_bus, np);
> > + mnp = of_get_child_by_name(np, "mdio");
> > + err = of_mdiobus_register(mii_bus, mnp);
>
> of_get_child_by_name() can fail, so error checking is necessary
> before you pass mnp into of_mdiobus_register().
Hi David
/**
* of_get_child_by_name - Find the child node by name for a given parent
* @node: parent node
* @name: child name to look for.
*
* This function looks for child node for given matching name
*
* Returns a node pointer if found, with refcount incremented, use
* of_node_put() on it when done.
* Returns NULL if node is not found.
*/
So on error, it returns NULL. And passing NULL to
of_mdiobus_register() is the correct thing to do if there is no DT
node. of_node_put() is also O.K. with NULL.
So this is all O.K. as is.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2019-10-01 16:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 6:41 Oleksij Rempel
2019-10-01 16:03 ` David Miller
2019-10-01 16:43 ` Andrew Lunn [this message]
2019-10-01 17:27 ` David Miller
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=20191001164340.GC2031@lunn.ch \
--to=andrew@lunn.ch \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=jcliburn@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
/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
all inboxes | Powered by JetHome®