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: <i3qp6sjkgqw2mgkbkrpgwxlbcdblwfp6vpohpfnb7tnq77mrpc@hrr3iv2flvqh>
Date: Fri, 8 Dec 2023 09:49:25 +0000
From: Alvin Šipraga <ALSI@...g-olufsen.dk>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>, "andrew@...n.ch"
	<andrew@...n.ch>, "f.fainelli@...il.com" <f.fainelli@...il.com>,
	"olteanv@...il.com" <olteanv@...il.com>, "davem@...emloft.net"
	<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"arinc.unal@...nc9.com" <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 2/7] net: dsa: realtek: put of node after MDIO
 registration

On Fri, Dec 08, 2023 at 02:13:25AM -0300, Luiz Angelo Daros de Luca wrote:
> > diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
> > index 755546ed8db6..ddcae546afbc 100644
> > --- a/drivers/net/dsa/realtek/realtek-smi.c
> > +++ b/drivers/net/dsa/realtek/realtek-smi.c
> > @@ -389,15 +389,15 @@ static int realtek_smi_setup_mdio(struct dsa_switch *ds)
> >         priv->user_mii_bus->write = realtek_smi_mdio_write;
> >         snprintf(priv->user_mii_bus->id, MII_BUS_ID_SIZE, "SMI-%d",
> >                  ds->index);
> > -       priv->user_mii_bus->dev.of_node = mdio_np;

You do not really justify removing this in your patch. This is not a
purely cosmetic change because now the associated mdiodev will not be
associated with the OF node. I don't know if there is any consequence to
that but it is usually nice to populate this info in the device struct
when it is actually available.

> >         priv->user_mii_bus->parent = priv->dev;
> >         ds->user_mii_bus = priv->user_mii_bus;
> >
> >         ret = devm_of_mdiobus_register(priv->dev, priv->user_mii_bus, mdio_np);
> > +       of_node_put(mdio_np);
> 
> I would like some advice on this line. I have seen similar code like
> this but I'm not sure if a function that receives that node as an
> argument should be responsible to call kobject_get() (or alike) if it
> keeps a reference for that node. The of_mdiobus_register does not keep
> that node but it does get some child nodes. I don't know if it is ok
> to free the parent node (if that ever happens when a child is still in
> use).

Yes, it's OK to do that.

> 
> Regards,
> 
> Luiz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ