]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mt76: dma: use kzalloc instead of devm_kzalloc for txwi
authorFelix Fietkau <nbd@nbd.name>
Sat, 19 Mar 2022 20:56:20 +0000 (21:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:14 +0000 (11:08 +0100)
[ Upstream commit 402e01092e79583923579662f244bc538f466f36 ]

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>
Stable-dep-of: 317620593349 ("wifi: mt76: mt7603: improve stuck beacon handling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/dma.c

index 69e0e68757f5352402ddacd3aa616203cbb39d11..1344c88729a84679dacbeb36066dc17828d54c06 100644 (file)
@@ -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();
 }