netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-kernel@vger.kernel.org, claudiu.manoil@nxp.com,
	mail@david-bauer.net
Subject: Re: [PATCH net-next] net: gianfar: fix NVMEM mac address
Date: Tue, 10 Sep 2024 07:44:41 +0100	[thread overview]
Message-ID: <20240910064441.GH2097826@kernel.org> (raw)
In-Reply-To: <CAKxU2N_y9CM=P3ki2XGDV+9nZ9SCQwC3y2qWRHbiEZzKK_t62Q@mail.gmail.com>

On Mon, Sep 09, 2024 at 12:14:38PM -0700, Rosen Penev wrote:
> On Mon, Sep 9, 2024 at 11:48 AM Simon Horman <horms@kernel.org> wrote:
> >
> > On Mon, Sep 09, 2024 at 11:20:20AM -0700, Rosen Penev wrote:
> > > On Mon, Sep 9, 2024 at 11:11 AM Rosen Penev <rosenp@gmail.com> wrote:
> > > >
> > > > On Mon, Sep 9, 2024 at 1:55 AM Simon Horman <horms@kernel.org> wrote:
> > > > >
> > > > > On Sun, Sep 08, 2024 at 02:35:54PM -0700, Rosen Penev wrote:
> > > > > > If nvmem loads after the ethernet driver, mac address assignments will
> > > > > > not take effect. of_get_ethdev_address returns EPROBE_DEFER in such a
> > > > > > case so we need to handle that to avoid eth_hw_addr_random.
> > > > > >
> > > > > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > > > > ---
> > > > > >  drivers/net/ethernet/freescale/gianfar.c | 2 ++
> > > > > >  1 file changed, 2 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
> > > > > > index 634049c83ebe..9755ec947029 100644
> > > > > > --- a/drivers/net/ethernet/freescale/gianfar.c
> > > > > > +++ b/drivers/net/ethernet/freescale/gianfar.c
> > > > > > @@ -716,6 +716,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
> > > > > >               priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
> > > > > >
> > > > > >       err = of_get_ethdev_address(np, dev);
> > > > > > +     if (err == -EPROBE_DEFER)
> > > > > > +             return err;
> > > > >
> > > > > To avoid leaking resources, I think this should be:
> > > > >
> > > > >                 goto err_grp_init;
> > > > will do in v2. Unfortunately net-next closes today AFAIK.
> > > On second thought, where did you find this?
> > >
> > > git grep err_grp_init
> > >
> > > returns nothing.
> > >
> > > Not only that, this function has no goto.
> >
> > Maybe we are looking at different things for some reason.
> Well that's embarrassing. Locally I seem to have a commit that adds a
> bunch of devm and as a result these gotos. Unfortunately I don't have
> the hardware to test those changes. I'll be doing a v2 for when
> net-next opens.

No problem. TBH it is a relief, as I was beginning to doubt my own sanity.

> >
> > I'm looking at this:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/ethernet/freescale/gianfar.c?id=bfba7bc8b7c2c100b76edb3a646fdce256392129#n814
> >
> > > > >
> > > > > Flagged by Smatch.
> > > > >
> > > > > >       if (err) {
> > > > > >               eth_hw_addr_random(dev);
> > > > > >               dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr);
> > > > >
> > > > > --
> > > > > pw-bot: cr
> > >
> 

      reply	other threads:[~2024-09-10  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-08 21:35 [PATCH net-next] net: gianfar: fix NVMEM mac address Rosen Penev
2024-09-09  4:22 ` Pavan Chebbi
2024-09-09 17:52   ` Rosen Penev
2024-09-09  8:55 ` Simon Horman
2024-09-09 18:11   ` Rosen Penev
2024-09-09 18:20     ` Rosen Penev
2024-09-09 18:48       ` Simon Horman
2024-09-09 19:14         ` Rosen Penev
2024-09-10  6:44           ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910064441.GH2097826@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@david-bauer.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rosenp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).