Skip to content

Commit

Permalink
mt76: dma: use kzalloc instead of devm_kzalloc for txwi
Browse files Browse the repository at this point in the history
dma unmap is already needed for cleanup anyway, so we don't need the extra
tracking and can save a bit of memory here

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Mar 19, 2022
1 parent a7805e4 commit 0b1deb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mt76_alloc_txwi(struct mt76_dev *dev)
int size;

size = L1_CACHE_ALIGN(dev->drv->txwi_size + sizeof(*t));
txwi = devm_kzalloc(dev->dev, size, GFP_ATOMIC);
txwi = kzalloc(size, GFP_ATOMIC);
if (!txwi)
return NULL;

Expand Down Expand Up @@ -73,9 +73,11 @@ mt76_free_pending_txwi(struct mt76_dev *dev)
struct mt76_txwi_cache *t;

local_bh_disable();
while ((t = __mt76_get_txwi(dev)) != NULL)
while ((t = __mt76_get_txwi(dev)) != NULL) {
dma_unmap_single(dev->dev, t->dma_addr, dev->drv->txwi_size,
DMA_TO_DEVICE);
kfree(mt76_get_txwi_ptr(dev, t));
}
local_bh_enable();
}

Expand Down

0 comments on commit 0b1deb9

Please sign in to comment.