[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191001164340.GC2031@lunn.ch>
Date: Tue, 1 Oct 2019 18:43:40 +0200
From: Andrew Lunn <andrew@...n.ch>
To: David Miller <davem@...emloft.net>
Cc: o.rempel@...gutronix.de, jcliburn@...il.com, chris.snook@...il.com,
kernel@...gutronix.de, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] net: ag71xx: fix mdio subnode support
On Tue, Oct 01, 2019 at 09:03:20AM -0700, David Miller wrote:
> From: Oleksij Rempel <o.rempel@...gutronix.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@...n.ch>
Andrew
Powered by blists - more mailing lists