Re: [PATCH] net: thunder_bgx: use OF loop instead of fwnode

From: Rosen Penev
Date: Mon Sep 01 2025 - 17:23:41 EST


On Mon, Sep 1, 2025 at 8:23 AM Simon Horman <horms@xxxxxxxxxx> wrote:
>
> On Sat, Aug 30, 2025 at 02:42:17PM -0700, Rosen Penev wrote:
> > The loop ends up converting fwnode to device_node anyway.
> >
> > While at it, handle return value of of_get_mac_address in case of NVMEM.
>
> I think that this part should be a separate patch.
> Possibly targeted at net with a Fixes tag.
I'll split up.
>
> >
> > Simplify while loop iteration.
> >
> > Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
>
> ...
>
> > @@ -1514,14 +1510,13 @@ static int bgx_init_of_phy(struct bgx *bgx)
> > /* We are bailing out, try not to leak device reference counts
> > * for phy devices we may have already found.
> > */
> > - while (lmac) {
> > + while (lmac--) {
> > if (bgx->lmac[lmac].phydev) {
> > put_device(&bgx->lmac[lmac].phydev->mdio.dev);
> > bgx->lmac[lmac].phydev = NULL;
> > }
> > - lmac--;
> > }
>
> The update to this look looks correct to me, even without the rest of
> the patch separate. If so, I'm wondering if it should also be a separate
> patch. Again, possibly for net with a Fixes tag.
Maybe not. This can get called while lmac is 0, which is a u8. lmac--
like this will underflow. I'll send it as a separate patch from the
upcoming series targeted at next.
>
> > - of_node_put(node);
> > + of_node_put(child);
> > return -EPROBE_DEFER;
> > }
>
> ...