From: Denis Orlov <denorl2009@gmail.com>
To: barebox@lists.infradead.org
Cc: Denis Orlov <denorl2009@gmail.com>
Subject: [PATCH 7/7] net: rtl8169: free allocated memory on halt()
Date: Wed, 20 Jul 2022 16:31:00 +0300 [thread overview]
Message-ID: <20220720133100.13580-8-denorl2009@gmail.com> (raw)
In-Reply-To: <20220720133100.13580-1-denorl2009@gmail.com>
Otherwise it just leaks.
Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
drivers/net/rtl8169.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 4b40c539dd..e923e179bf 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -478,6 +478,18 @@ static void rtl8169_eth_halt(struct eth_device *edev)
RTL_W32(priv, RxMissed, 0);
pci_clear_master(priv->pci_dev);
+
+ dma_unmap_single(&edev->dev, priv->tx_buf_phys, NUM_TX_DESC * PKT_BUF_SIZE,
+ DMA_TO_DEVICE);
+ free(priv->tx_buf);
+ dma_free_coherent((void *)priv->tx_desc, priv->tx_desc_phys,
+ NUM_TX_DESC * sizeof(struct bufdesc));
+
+ dma_unmap_single(&edev->dev, priv->rx_buf_phys, NUM_RX_DESC * PKT_BUF_SIZE,
+ DMA_FROM_DEVICE);
+ free(priv->rx_buf);
+ dma_free_coherent((void *)priv->rx_desc, priv->rx_desc_phys,
+ NUM_RX_DESC * sizeof(struct bufdesc));
}
static int rtl8169_probe(struct pci_dev *pdev, const struct pci_device_id *id)
--
2.20.1
next prev parent reply other threads:[~2022-07-20 13:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 13:30 [PATCH 0/7] e1000 and rtl8169 drivers fixes Denis Orlov
2022-07-20 13:30 ` [PATCH 1/7] net: e1000: remove superfluous allocation check Denis Orlov
2022-07-20 13:30 ` [PATCH 2/7] net: e1000: properly read/write MDI registers on 8254x cards Denis Orlov
2022-07-20 13:30 ` [PATCH 3/7] net: e1000: do not actually acquire/put swfw_sync " Denis Orlov
2022-07-20 13:30 ` [PATCH 4/7] net: e1000: configure tx/rx and rctl in open() instead of init() Denis Orlov
2022-07-20 13:30 ` [PATCH 5/7] net: rtl8169: properly map rx/tx buffers for dma Denis Orlov
2022-07-20 13:30 ` [PATCH 6/7] net: rtl8169: enable pci device bus mastering on ifup Denis Orlov
2022-07-20 13:31 ` Denis Orlov [this message]
2022-08-09 6:48 ` [PATCH 0/7] e1000 and rtl8169 drivers fixes Sascha Hauer
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=20220720133100.13580-8-denorl2009@gmail.com \
--to=denorl2009@gmail.com \
--cc=barebox@lists.infradead.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