lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <C246CAC1457055469EF09E3A7AC4E11A4A5E27C6@XAP-PVEXMBX01.xlnx.xilinx.com>
Date:	Tue, 16 Aug 2016 07:01:49 +0000
From:	Appana Durga Kedareswara Rao <appana.durga.rao@...inx.com>
To:	David Miller <davem@...emloft.net>
CC:	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	"mark.rutland@....com" <mark.rutland@....com>,
	"nicolas.ferre@...el.com" <nicolas.ferre@...el.com>,
	"sergio.prado@...abworks.com" <sergio.prado@...abworks.com>,
	"gregory.clement@...e-electrons.com" 
	<gregory.clement@...e-electrons.com>,
	"narmstrong@...libre.com" <narmstrong@...libre.com>,
	Michal Simek <michals@...inx.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net: macb: add phy-handle support for the macb

Hi David Miller,

	Thanks for the review...

> 
> From: Kedareswara rao Appana <appana.durga.rao@...inx.com>
> Date: Sat, 13 Aug 2016 15:31:49 +0530
> 
> > @@ -445,7 +445,13 @@ static int macb_mii_init(struct macb *bp)
> >  	dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
> >
> >  	np = bp->pdev->dev.of_node;
> > -	if (np) {
> > +	np1 = of_get_parent(bp->phy_node);
> > +	if (np1) {
> > +		of_node_put(np1);
> > +		err = of_mdiobus_register(bp->mii_bus, np1);
> > +		if (err)
> > +			goto err_out_unregister_bus;
> > +	} else if (np) {
> 
> I don't know about this, all OF nodes other than the root have a parent node
> which is non-NULL.  This parent node can be anything.
> 
> Just blinding assuming that any parent node of the phy_node is what we are
> looking for, without any other supplementary checks at all, seems to be asking
> for trouble at the very least.

Agree with you my intention is if there is a MDIO bus on the device-tree
The MAC driver should create PHY/MDIO devices using of_mdiobus_register().

How about below code...

-       struct device_node *np;
+       struct device_node *np, *np1;
        int err = -ENXIO, i;
 
        /* Enable management port */
@@ -445,7 +445,14 @@ static int macb_mii_init(struct macb *bp)
        dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
 
        np = bp->pdev->dev.of_node;
-       if (np) {
+       np1 = of_get_child_by_name(np, "mdio");
+       if (np1) {
+               of_node_put(np1);
+               err = of_mdiobus_register(bp->mii_bus, np1);
+               if (err)
+                       goto err_out_unregister_bus;
+       } else if (np) {
                /* try dt phy registration */
                err = of_mdiobus_register(bp->mii_bus, np);

If you are ok with the above code please let me know will post it as v2...

Regards,
Kedar.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ