From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 4/8] mt76: dma: use kzalloc instead of devm_kzalloc for txwi
Date: Fri, 25 Mar 2022 22:10:27 +0100 [thread overview]
Message-ID: <20220325211031.24171-4-nbd@nbd.name> (raw)
In-Reply-To: <20220325211031.24171-1-nbd@nbd.name>
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>
---
drivers/net/wireless/mediatek/mt76/dma.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 02daeefb0761..09dc37bbf112 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -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;
@@ -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();
}
--
2.35.1
next prev parent reply other threads:[~2022-03-25 21:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 21:10 [PATCH 1/8] mt76: mt7915: fix DBDC default band selection on MT7915D Felix Fietkau
2022-03-25 21:10 ` [PATCH 2/8] mt76: mt7915: rework hardware/phy initialization Felix Fietkau
2022-03-25 21:10 ` [PATCH 3/8] mt76: reduce tx queue lock hold time Felix Fietkau
2022-03-25 21:10 ` Felix Fietkau [this message]
2022-03-25 21:10 ` [PATCH 5/8] mt76: dma: reduce lock contention in mt76_dma_tx_cleanup Felix Fietkau
2022-03-25 21:10 ` [PATCH 6/8] mt76: mt7915: accept rx frames with non-standard VHT MCS10-11 Felix Fietkau
2022-03-25 21:10 ` [PATCH 7/8] mt76: mt7921: " Felix Fietkau
2022-03-25 21:10 ` [PATCH 8/8] mt76: fix use-after-free by removing a non-RCU wcid pointer Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220325211031.24171-4-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox