RE: [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration
From: David Thompson
Date: Thu May 28 2026 - 12:10:25 EST
> -----Original Message-----
> From: Jacob Keller <jacob.e.keller@xxxxxxxxx>
> Sent: Wednesday, May 27, 2026 4:32 PM
> To: David Thompson <davthompson@xxxxxxxxxx>;
> bryan.whitehead@xxxxxxxxxxxxx; UNGLinuxDriver@xxxxxxxxxxxxx;
> andrew+netdev@xxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx;
> kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging
> before netdev registration
>
> On 5/27/2026 11:18 AM, 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_ 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.
> >
> > Signed-off-by: David Thompson <davthompson@xxxxxxxxxx>
> > ---
> > v2:
> > - Changed target repo from "net" to "net-next"
> > - Removed "Fixes" tag
> > ---
> > 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 793633cced19..bca2f3d1ad41 100644
> > --- a/drivers/net/ethernet/microchip/lan743x_main.c
> > +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> > @@ -119,9 +119,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))
> > + pci_info(pdev,
> > + "PCI: Vendor ID = 0x%04X, Device ID = 0x%04X\n",
> > + pdev->vendor, pdev->device);
>
> Do you really need to check netif_msg here? I guess it keeps the log from being
> cluttered based on the message levels enabled. I would probably just do
> dev_dbg() for all of these and let users use dynamic debugging to
> enable/disable precisely which messages they want instead of the
> message_enable bits.
>
> Also, sometimes you use pci_info and other times you use dev_info. Why not
> be consistent?
Thanks for the reply Jacob.
I will update the code to use dev_dbg(), which can be controlled via dynamic debugging.
- Dave