Re: [PATCH 5.10 64/98] net: mdio-mux: Handle -EPROBE_DEFER correctly

From: Pavel Machek
Date: Wed Aug 25 2021 - 01:05:40 EST


Hi!

> > > When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't
> > > ignore it and continue registering the rest of the mdiobus children. This
> > > would permanently prevent the deferring child mdiobus from working instead
> > > of reattempting it in the future. So, if a child mdiobus needs to be
> > > reattempted in the future, defer the entire mdio-mux initialization.
> > >
> > > This fixes the issue where PHYs sitting under the mdio-mux aren't
> > > initialized correctly if the PHY's interrupt controller is not yet ready
> > > when the mdio-mux is being probed. Additional context in the link
> > > below.
> >
> > I don't believe this is quite right. AFAICT it leaks memory in the
> > EPROBE_DEFER case. Could someone double-check? Suggested fix is below.
>
> devm_ APIs would take care of releasing the resource (memory)
> automatically because the probe didn't succeed. So I'm not sure
> there's a leak. Does that make sense?

Yes, it does, I believe you are right.

This part of code confused me: We are going to return error there, yet
we do explicit tree, which should not be neccessary according to this
logic.


dev_err(dev, "Error: No acceptable child buses found\n");
devm_kfree(dev, pb);

Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature