RE: [PATCH net] net: lan743x: avoid netdev-based logging before netdev registration
From: David Thompson
Date: Wed May 27 2026 - 13:27:35 EST
> -----Original Message-----
> From: David Thompson <davthompson@xxxxxxxxxx>
> Sent: Wednesday, May 20, 2026 3:59 PM
> To: Jakub Kicinski <kuba@xxxxxxxxxx>
> Cc: bryan.whitehead@xxxxxxxxxxxxx; UNGLinuxDriver@xxxxxxxxxxxxx;
> andrew+netdev@xxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: RE: [PATCH net] net: lan743x: avoid netdev-based logging before
> netdev registration
>
>
>
> > -----Original Message-----
> > From: Jakub Kicinski <kuba@xxxxxxxxxx>
> > Sent: Tuesday, May 19, 2026 9:41 PM
> > To: David Thompson <davthompson@xxxxxxxxxx>
> > Cc: bryan.whitehead@xxxxxxxxxxxxx; UNGLinuxDriver@xxxxxxxxxxxxx;
> > andrew+netdev@xxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx;
> > pabeni@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> > linux-kernel@xxxxxxxxxxxxxxx
> > Subject: Re: [PATCH net] net: lan743x: avoid netdev-based logging
> > before netdev registration
> >
> > On Fri, 15 May 2026 21:52:29 +0000 David Thompson wrote:
> > > This patch updates the lan743x driver to prevent the use of
> > > netdev-based logging APIs (such as netdev_dbg) before the network
> > > device has been successfully registered. Using netdev-based logging
> > > prior to registration results in log messages referencing "(unnamed
> > > net_device) (uninitialized)", which can be confusing and less informative.
> > >
> > > The driver must use netif_msg_x APIs and device-based logging (e.g.
> > > dev_dbg) until netdev registration is complete. This ensures log
> > > entries are associated with the correct device context and improves
> > > log clarity. After registration, netdev-based logging APIs can be used safely.
> > >
> > > Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x
> > > driver")
> >
> > Not a fix
> >
>
> Fair enough. I'll create a v2 and post it to net-next.
>
> > > Signed-off-by: David Thompson <davthompson@xxxxxxxxxx>
> > > ---
> > > drivers/net/ethernet/microchip/lan743x_main.c | 72
> > > ++++++++++++-------
> > > 1 file changed, 45 insertions(+), 27 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/microchip/lan743x_main.c
> > > b/drivers/net/ethernet/microchip/lan743x_main.c
> > > index f3332417162e..53492573f08d 100644
> > > --- a/drivers/net/ethernet/microchip/lan743x_main.c
> > > +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> > > @@ -108,9 +108,10 @@ static int lan743x_pci_init(struct
> > > lan743x_adapter
> > *adapter,
> > > if (ret)
> > > goto return_error;
> > >
> > > - netif_info(adapter, probe, adapter->netdev,
> > > - "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
> > > - pdev->vendor, pdev->device);
> > > + if (netif_msg_probe(adapter))
> >
> > please drop these checks. They are always true.
>
> Good point, I will drop these checks in v2.
>
While preparing v2, I realized it makes more sense to add a module parameter to control the initial value of msg_enable, instead of hardcoding it during probe. I'll update v2 to include this change, which means I'll also need to keep the checks that were previously always true.
> > And the message categorization is not encouraged.
>
> Are you requesting that I change pci_info/dev_info portions of the patch into
> pci_dbg/dev_dbg?
>
> > --
> > pw-bot: cr