ixgbe: fix uninitialized event.type in ixgbe_ptp_check_pps_event
authorJacob Keller <jacob.e.keller@intel.com>
Sat, 13 Oct 2012 05:00:06 +0000 (05:00 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 1 Nov 2012 08:41:54 +0000 (01:41 -0700)
This patch fixes a bug in ixgbe_ptp_check_pps_event where the type was
uninitialized and could cause unknown event outcomes.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c

index 842ba15..01d99af 100644 (file)
@@ -387,6 +387,15 @@ void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr)
        struct ixgbe_hw *hw = &adapter->hw;
        struct ptp_clock_event event;
 
+       event.type = PTP_CLOCK_PPS;
+
+       /* this check is necessary in case the interrupt was enabled via some
+        * alternative means (ex. debug_fs). Better to check here than
+        * everywhere that calls this function.
+        */
+       if (!adapter->ptp_clock)
+               return;
+
        switch (hw->mac.type) {
        case ixgbe_mac_X540:
                ptp_clock_event(adapter->ptp_clock, &event);