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: <CAKxU2N-SDtFCrXWDc_2fGKSjosjBg=s4PJ2ztETrocTDo75ayQ@mail.gmail.com>
Date: Tue, 27 Aug 2024 16:36:41 -0700
From: Rosen Penev <rosenp@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com, 
	pabeni@...hat.com, linux@...linux.org.uk, linux-kernel@...r.kernel.org, 
	o.rempel@...gutronix.de, p.zabel@...gutronix.de
Subject: Re: [PATCHv4 net-next] net: ag71xx: get reset control using devm api

On Tue, Aug 27, 2024 at 4:13 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Mon, 26 Aug 2024 14:21:57 -0700 Rosen Penev wrote:
> > Currently, the of variant is missing reset_control_put in error paths.
> > The devm variant does not require it.
> >
> > Allows removing mdio_reset from the struct as it is not used outside the
> > function.
>
> > @@ -683,6 +682,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
> >       struct device *dev = &ag->pdev->dev;
> >       struct net_device *ndev = ag->ndev;
> >       static struct mii_bus *mii_bus;
> > +     struct reset_control *mdio_reset;
>
> nit: maintain the longest to shortest ordering of the variables
> (sorted by line length not type length)
>
> >       struct device_node *np, *mnp;
> >       int err;
> >
> > @@ -698,10 +698,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
> >       if (!mii_bus)
> >               return -ENOMEM;
> >
> > -     ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio");
> > -     if (IS_ERR(ag->mdio_reset)) {
> > +     mdio_reset = devm_reset_control_get_exclusive(dev, "mdio");
> > +     if (IS_ERR(mdio_reset)) {
> >               netif_err(ag, probe, ndev, "Failed to get reset mdio.\n");
> > -             return PTR_ERR(ag->mdio_reset);
> > +             return PTR_ERR(mdio_reset);
> >       }
> >
> >       mii_bus->name = "ag71xx_mdio";
> > @@ -712,10 +712,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
> >       mii_bus->parent = dev;
> >       snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s.%d", np->name, ag->mac_idx);
> >
> > -     if (!IS_ERR(ag->mdio_reset)) {
> > -             reset_control_assert(ag->mdio_reset);
> > +     if (!IS_ERR(mdio_reset)) {
>
> Are you planning to follow up to remove this check?
> Would be nice to do that as second patch in the same series
I actually have no idea why this is here. I assume it's some mistake.
I don't think it's meant to be optional...
>
> > +             reset_control_assert(mdio_reset);
> >               msleep(100);
> > -             reset_control_deassert(ag->mdio_reset);
> > +             reset_control_deassert(mdio_reset);
> >               msleep(200);
> >       }
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ