diff --git a/[refs] b/[refs] index 3b2887ecdd7b..6829dd6e3c38 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 742246f8bc16c3a1a556c68ca2fabca162d14c24 +refs/heads/master: bdf91cfae66dd76a093c75cac8f6ada12fd21b83 diff --git a/trunk/drivers/net/wireless/wl12xx/main.c b/trunk/drivers/net/wireless/wl12xx/main.c index 027b6742a151..0fa3a2281ddb 100644 --- a/trunk/drivers/net/wireless/wl12xx/main.c +++ b/trunk/drivers/net/wireless/wl12xx/main.c @@ -834,8 +834,15 @@ static void wl12xx_fw_status(struct wl1271 *wl, wl->tx_pkts_freed[i] = status->tx_released_pkts[i]; } - freed_blocks = le32_to_cpu(status->total_released_blks) - - wl->tx_blocks_freed; + /* prevent wrap-around in total blocks counter */ + if (likely(wl->tx_blocks_freed <= + le32_to_cpu(status->total_released_blks))) + freed_blocks = le32_to_cpu(status->total_released_blks) - + wl->tx_blocks_freed; + else + freed_blocks = 0x100000000LL - wl->tx_blocks_freed + + le32_to_cpu(status->total_released_blks); + wl->tx_blocks_freed = le32_to_cpu(status->total_released_blks); wl->tx_allocated_blocks -= freed_blocks;