From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Zheyu Ma <zheyuma97@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
kuba@kernel.org, tanghui20@huawei.com,
christophe.jaillet@wanadoo.fr, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 5/7] ethernet: sun: Free the coherent when failing in probing
Date: Wed, 16 Mar 2022 10:17:36 -0400 [thread overview]
Message-ID: <20220316141738.248513-5-sashal@kernel.org> (raw)
In-Reply-To: <20220316141738.248513-1-sashal@kernel.org>
From: Zheyu Ma <zheyuma97@gmail.com>
[ Upstream commit bb77bd31c281f70ec77c9c4f584950a779e05cf8 ]
When the driver fails to register net device, it should free the DMA
region first, and then do other cleanup.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sun/sunhme.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index d007dfeba5c3..3133f903279c 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -3164,7 +3164,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
if (err) {
printk(KERN_ERR "happymeal(PCI): Cannot register net device, "
"aborting.\n");
- goto err_out_iounmap;
+ goto err_out_free_coherent;
}
pci_set_drvdata(pdev, hp);
@@ -3197,6 +3197,10 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
return 0;
+err_out_free_coherent:
+ dma_free_coherent(hp->dma_dev, PAGE_SIZE,
+ hp->happy_block, hp->hblock_dvma);
+
err_out_iounmap:
iounmap(hp->gregs);
--
2.34.1
next prev parent reply other threads:[~2022-03-16 14:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 14:17 [PATCH AUTOSEL 5.4 1/7] HID: logitech-dj: add new lightspeed receiver id Sasha Levin
2022-03-16 14:17 ` [PATCH AUTOSEL 5.4 2/7] xfrm: fix tunnel model fragmentation behavior Sasha Levin
2022-03-16 14:17 ` [PATCH AUTOSEL 5.4 3/7] virtio_console: break out of buf poll on remove Sasha Levin
2022-03-16 14:17 ` [PATCH AUTOSEL 5.4 4/7] Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0" Sasha Levin
2022-03-16 14:17 ` Sasha Levin [this message]
2022-03-16 14:17 ` [PATCH AUTOSEL 5.4 6/7] spi: Fix invalid sgs value Sasha Levin
2022-03-16 14:17 ` [PATCH AUTOSEL 5.4 7/7] net:mcf8390: Use platform_get_irq() to get the interrupt Sasha Levin
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=20220316141738.248513-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andrew@lunn.ch \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tanghui20@huawei.com \
--cc=zheyuma97@gmail.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;
as well as URLs for NNTP newsgroup(s).