madwifi: fix division by zero

SVN-Revision: 13521
v19.07.3_mercusys_ac12_duma
Felix Fietkau 16 years ago
parent 130413bb0f
commit 95a9e47a00

@ -16,7 +16,7 @@
sc->sc_curchan.channel = ic->ic_curchan->ic_freq; sc->sc_curchan.channel = ic->ic_curchan->ic_freq;
sc->sc_curchan.channelFlags = ath_chan2flags(ic->ic_curchan); sc->sc_curchan.channelFlags = ath_chan2flags(ic->ic_curchan);
if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) { if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
@@ -2913,6 +2915,37 @@ ath_hw_check_atim(struct ath_softc *sc, @@ -2913,6 +2915,40 @@ ath_hw_check_atim(struct ath_softc *sc,
} }
@ -38,6 +38,9 @@
+ +
+ rx = OS_REG_READ(ah, AR5K_RXCLEAR); + rx = OS_REG_READ(ah, AR5K_RXCLEAR);
+ cc = OS_REG_READ(ah, AR5K_CYCLES); + cc = OS_REG_READ(ah, AR5K_CYCLES);
+ if (!cc)
+ return;
+
+ if (rx > cc) + if (rx > cc)
+ return; /* wraparound */ + return; /* wraparound */
+ +
@ -54,7 +57,7 @@
/* /*
* Reset the hardware w/o losing operational state. This is * Reset the hardware w/o losing operational state. This is
* basically a more efficient way of doing ath_stop, ath_init, * basically a more efficient way of doing ath_stop, ath_init,
@@ -2939,6 +2972,7 @@ ath_reset(struct net_device *dev) @@ -2939,6 +2975,7 @@ ath_reset(struct net_device *dev)
* Convert to a HAL channel description with the flags * Convert to a HAL channel description with the flags
* constrained to reflect the current operating mode. * constrained to reflect the current operating mode.
*/ */
@ -62,7 +65,7 @@
c = ic->ic_curchan; c = ic->ic_curchan;
sc->sc_curchan.channel = c->ic_freq; sc->sc_curchan.channel = c->ic_freq;
sc->sc_curchan.channelFlags = ath_chan2flags(c); sc->sc_curchan.channelFlags = ath_chan2flags(c);
@@ -9019,6 +9053,7 @@ ath_chan_set(struct ath_softc *sc, struc @@ -9019,6 +9056,7 @@ ath_chan_set(struct ath_softc *sc, struc
u_int8_t channel_change_required = 0; u_int8_t channel_change_required = 0;
struct timeval tv; struct timeval tv;

@ -1,6 +1,6 @@
--- a/ath/if_ath.c --- a/ath/if_ath.c
+++ b/ath/if_ath.c +++ b/ath/if_ath.c
@@ -6507,7 +6507,7 @@ ath_capture(struct net_device *dev, cons @@ -6510,7 +6510,7 @@ ath_capture(struct net_device *dev, cons
/* Never copy the SKB, as it is ours on the RX side, and this is the /* Never copy the SKB, as it is ours on the RX side, and this is the
* last process on the TX side and we only modify our own headers. */ * last process on the TX side and we only modify our own headers. */
@ -9,7 +9,7 @@
if (tskb == NULL) { if (tskb == NULL) {
DPRINTF(sc, ATH_DEBUG_ANY, DPRINTF(sc, ATH_DEBUG_ANY,
"Dropping; ath_skb_removepad failed!\n"); "Dropping; ath_skb_removepad failed!\n");
@@ -6515,6 +6515,8 @@ ath_capture(struct net_device *dev, cons @@ -6518,6 +6518,8 @@ ath_capture(struct net_device *dev, cons
} }
ieee80211_input_monitor(ic, tskb, bf, tx, tsf, sc); ieee80211_input_monitor(ic, tskb, bf, tx, tsf, sc);

@ -10,7 +10,7 @@
Please let us know if you think your name should be mentioned here! Please let us know if you think your name should be mentioned here!
--- a/ath/if_ath.c --- a/ath/if_ath.c
+++ b/ath/if_ath.c +++ b/ath/if_ath.c
@@ -3126,7 +3126,7 @@ ath_tx_startraw(struct net_device *dev, @@ -3129,7 +3129,7 @@ ath_tx_startraw(struct net_device *dev,
struct ath_softc *sc = dev->priv; struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)

@ -108,7 +108,7 @@
/* /*
* Check if the MAC has multi-rate retry support. * Check if the MAC has multi-rate retry support.
* We do this by trying to setup a fake extended * We do this by trying to setup a fake extended
@@ -7521,7 +7529,7 @@ ath_txq_setup(struct ath_softc *sc, int @@ -7524,7 +7532,7 @@ ath_txq_setup(struct ath_softc *sc, int
if (qtype == HAL_TX_QUEUE_UAPSD) if (qtype == HAL_TX_QUEUE_UAPSD)
qi.tqi_qflags = HAL_TXQ_TXDESCINT_ENABLE; qi.tqi_qflags = HAL_TXQ_TXDESCINT_ENABLE;
else else

Loading…
Cancel
Save