Do not run a timestamp processing callback on unready hardware
thus avoiding hitting uninitialized structures etc.

Fixes: 88b68f35eb43 ("ice: PTP: fix missing timestamps on E825 hardware")
Signed-off-by: Sergey Temerkhanov <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
---

Previous version: 
https://lore.kernel.org/intel-wired-lan/[email protected]/
v1->v2: Skip possible extra work on E830

 drivers/net/ethernet/intel/ice/ice_ptp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c 
b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 06842c06c689..2da510850a2b 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2820,6 +2820,9 @@ s8 ice_ptp_request_ts(struct ice_ptp_tx *tx, struct 
sk_buff *skb)
 
 void ice_ptp_process_ts(struct ice_pf *pf)
 {
+       if (pf->ptp.state != ICE_PTP_READY)
+               return;
+
        switch (pf->ptp.tx_interrupt_mode) {
        case ICE_PTP_TX_INTERRUPT_NONE:
                /* This device has the clock owner handle timestamps for it */
@@ -2949,6 +2952,9 @@ irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
                return IRQ_WAKE_THREAD;
        case ICE_MAC_E830:
                /* E830 can read timestamps in the top half using rd32() */
+               if (pf->ptp.state != ICE_PTP_READY)
+                       return IRQ_HANDLED;
+
                ice_ptp_process_ts(pf);
 
                if (ice_ptp_tx_tstamps_pending(pf, true)) {
-- 
2.53.0

Reply via email to