]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
igc: fix a log entry using uninitialized netdev
authorCorinna Vinschen <vinschen@redhat.com>
Tue, 23 Apr 2024 10:24:54 +0000 (12:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Jul 2024 10:51:04 +0000 (12:51 +0200)
[ Upstream commit 86167183a17e03ec77198897975e9fdfbd53cb0b ]

During successful probe, igc logs this:

[    5.133667] igc 0000:01:00.0 (unnamed net_device) (uninitialized): PHC added
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The reason is that igc_ptp_init() is called very early, even before
register_netdev() has been called. So the netdev_info() call works
on a partially uninitialized netdev.

Fix this by calling igc_ptp_init() after register_netdev(), right
after the media autosense check, just as in igb.  Add a comment,
just as in igb.

Now the log message is fine:

[    5.200987] igc 0000:01:00.0 eth0: PHC added

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/igc/igc_main.c

index 58bc96021bb4ca6f8e90adf1e69e98732ea7d149..07feb951be7494d75fd77f340917df17d39bb8ff 100644 (file)
@@ -6932,8 +6932,6 @@ static int igc_probe(struct pci_dev *pdev,
        device_set_wakeup_enable(&adapter->pdev->dev,
                                 adapter->flags & IGC_FLAG_WOL_SUPPORTED);
 
-       igc_ptp_init(adapter);
-
        igc_tsn_clear_schedule(adapter);
 
        /* reset the hardware with the new settings */
@@ -6955,6 +6953,9 @@ static int igc_probe(struct pci_dev *pdev,
        /* Check if Media Autosense is enabled */
        adapter->ei = *ei;
 
+       /* do hw tstamp init after resetting */
+       igc_ptp_init(adapter);
+
        /* print pcie link status and MAC address */
        pcie_print_link_status(pdev);
        netdev_info(netdev, "MAC: %pM\n", netdev->dev_addr);