Thread (7 messages) 7 messages, 2 authors, 2026-05-28

RE: [PATCH net-next v2 2/2] net: lan743x: avoid netdev-based logging before netdev registration

From: David Thompson <davthompson@nvidia.com>
Date: 2026-05-28 15:48:41
Also in: lkml

-----Original Message-----
From: Jacob Keller <jacob.e.keller@intel.com>
Sent: Wednesday, May 27, 2026 4:32 PM
To: David Thompson <davthompson@nvidia.com>;
bryan.whitehead@microchip.com; UNGLinuxDriver@microchip.com;
andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com;
kuba@kernel.org; pabeni@redhat.com
Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
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:
quoted
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@nvidia.com>
---
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,
quoted
 	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help