From: Miaoqian Lin <linmq006@gmail•com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@gmail•com, Wolfgang Grandegger <wg@grandegger•com>,
Marc Kleine-Budde <mkl@pengutronix•de>,
"David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>,
Kurt Van Dijck <dev.kurt@vandijck-laurijssen•be>,
linux-can@vger•kernel.org, netdev@vger•kernel.org,
linux-kernel@vger•kernel.org
Subject: [PATCH] softingcs: Fix memleak on registration failure in softingcs_probe
Date: Sat, 8 Jan 2022 09:25:51 +0000 [thread overview]
Message-ID: <20220108092555.17648-1-linmq006@gmail.com> (raw)
In case device registration fails during module initialisation, the
platform device structure needs to be freed using platform_device_put()
to properly free all resources (e.g. the device name).
Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card")
Signed-off-by: Miaoqian Lin <linmq006@gmail•com>
---
drivers/net/can/softing/softing_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c
index 2e93ee792373..e5c939b63fa6 100644
--- a/drivers/net/can/softing/softing_cs.c
+++ b/drivers/net/can/softing/softing_cs.c
@@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia)
return 0;
platform_failed:
- kfree(dev);
+ platform_device_put(pdev);
mem_failed:
pcmcia_bad:
pcmcia_failed:
--
2.17.1
next reply other threads:[~2022-01-08 9:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 9:25 Miaoqian Lin [this message]
2022-01-08 21:47 ` [PATCH] softingcs: Fix memleak on registration failure in softingcs_probe Marc Kleine-Budde
2022-01-09 22:10 ` patchwork-bot+netdevbpf
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=20220108092555.17648-1-linmq006@gmail.com \
--to=linmq006@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dev.kurt@vandijck-laurijssen$(echo .)be \
--cc=kuba@kernel$(echo .)org \
--cc=linux-can@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mkl@pengutronix$(echo .)de \
--cc=netdev@vger$(echo .)kernel.org \
--cc=wg@grandegger$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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