public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Gaosheng Cui <cuigaosheng1@huawei.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <thomas.lendacky@amd.com>,
	<shayagr@amazon.com>, <cuigaosheng1@huawei.com>,
	<wsa+renesas@sang-engineering.com>, <msink@permonline.ru>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH net] net: ethernet: wiznet: w5300: free irq when alloc link_name failed in w5300_hw_probe()
Date: Sat, 19 Nov 2022 15:10:07 +0800	[thread overview]
Message-ID: <20221119071007.3858043-1-cuigaosheng1@huawei.com> (raw)

When alloc link_name failed in w5300_hw_probe(), irq has not been
freed. Fix it.

Fixes: 9899b81e7ca5 ("Ethernet driver for the WIZnet W5300 chip")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/net/ethernet/wiznet/w5300.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index b0958fe8111e..5571d4c365e9 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -572,8 +572,10 @@ static int w5300_hw_probe(struct platform_device *pdev)
 	priv->link_gpio = data ? data->link_gpio : -EINVAL;
 	if (gpio_is_valid(priv->link_gpio)) {
 		char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
-		if (!link_name)
+		if (!link_name) {
+			free_irq(irq, ndev);
 			return -ENOMEM;
+		}
 		snprintf(link_name, 16, "%s-link", name);
 		priv->link_irq = gpio_to_irq(priv->link_gpio);
 		if (request_any_context_irq(priv->link_irq, w5300_detect_link,
-- 
2.25.1


             reply	other threads:[~2022-11-19  7:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19  7:10 Gaosheng Cui [this message]
2022-11-22 12:28 ` [PATCH net] net: ethernet: wiznet: w5300: free irq when alloc link_name failed in w5300_hw_probe() Leon Romanovsky
2022-11-22 13:05   ` cuigaosheng

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=20221119071007.3858043-1-cuigaosheng1@huawei.com \
    --to=cuigaosheng1@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=msink@permonline.ru \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shayagr@amazon.com \
    --cc=thomas.lendacky@amd.com \
    --cc=wsa+renesas@sang-engineering.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