From: Hungyu Lin <dennylin0707@gmail.com>
To: pkshih@realtek.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
pchelkin@ispras.ru, mihaildimoski@gmail.com,
tristan@talencesecurity.com, rtl8821cerfe2@gmail.com,
dawei.feng@seu.edu.cn, learn.rahul.rai@gmail.com,
branislav.klocok@orava.sk, timlee@realtek.com, kvalo@kernel.org,
briannorris@chromium.org, yhchuang@realtek.com,
sgruszka@redhat.com, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH] wifi: rtw88: pci: preserve the RX ring DMA address on cleanup
Date: Fri, 9 Oct 2026 03:23:39 +0000 [thread overview]
Message-ID: <20261009032339.31786-1-dennylin0707@gmail.com> (raw)
rtw_pci_init_rx_ring() stores the coherent ring DMA address in dma, but
reuses it for RX buffer DMA addresses during error cleanup. If
initialization fails after at least one buffer has been mapped,
dma_free_coherent() receives the last buffer's DMA address instead of
the ring's.
Use a separate variable for the buffer DMA addresses so the ring is
freed with the address returned by dma_alloc_coherent().
Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/net/wireless/realtek/rtw88/pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 66d2e5f51444..10147375f3b2 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -298,11 +298,13 @@ static int rtw_pci_init_rx_ring(struct rtw_dev *rtwdev,
err_out:
for (i = 0; i < allocated; i++) {
+ dma_addr_t buf_dma;
+
skb = rx_ring->buf[i];
if (!skb)
continue;
- dma = *((dma_addr_t *)skb->cb);
- dma_unmap_single(&pdev->dev, dma, buf_sz, DMA_FROM_DEVICE);
+ buf_dma = *((dma_addr_t *)skb->cb);
+ dma_unmap_single(&pdev->dev, buf_dma, buf_sz, DMA_FROM_DEVICE);
dev_kfree_skb_any(skb);
rx_ring->buf[i] = NULL;
}
next reply other threads:[~2026-10-09 3:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 3:23 Hungyu Lin [this message]
2026-10-09 11:50 ` Luka Gejak
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=20261009032339.31786-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=branislav.klocok@orava.sk \
--cc=briannorris@chromium.org \
--cc=dawei.feng@seu.edu.cn \
--cc=kvalo@kernel.org \
--cc=learn.rahul.rai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mihaildimoski@gmail.com \
--cc=pchelkin@ispras.ru \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
--cc=sgruszka@redhat.com \
--cc=timlee@realtek.com \
--cc=tristan@talencesecurity.com \
--cc=yhchuang@realtek.com \
/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
all inboxes | Powered by JetHome®