diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index c553b7a50eea..d6f241fed724 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -74,24 +74,26 @@ while (0) #ifndef DISABLE_DP_STATS #define DP_STATS_INC(_handle, _field, _delta) \ { \ - _handle->stats._field += _delta; \ + if (likely(_handle)) \ + _handle->stats._field += _delta; \ } #define DP_STATS_INCC(_handle, _field, _delta, _cond) \ { \ - if (_cond) { \ + if (_cond && likely(_handle)) \ _handle->stats._field += _delta; \ - } \ } #define DP_STATS_DEC(_handle, _field, _delta) \ { \ - _handle->stats._field -= _delta; \ + if (likely(_handle)) \ + _handle->stats._field -= _delta; \ } #define DP_STATS_UPD(_handle, _field, _delta) \ { \ - _handle->stats._field = _delta; \ + if (likely(_handle)) \ + _handle->stats._field = _delta; \ } #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \ diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 42b8877d61ad..862655d4df79 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -1290,7 +1290,7 @@ done: DP_STATS_INC_PKT(peer, rx.to_stack, 1, pkt_len); - if ((pdev->enhanced_stats_en) && + if ((pdev->enhanced_stats_en) && likely(peer) && hal_rx_attn_first_mpdu_get(rx_tlv_hdr)) { if (soc->cdp_soc.ol_ops->update_dp_stats) { soc->cdp_soc.ol_ops->update_dp_stats(