From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH] usb: dwc2: Fix memory leak in probe error path
Date: Fri, 3 Mar 2023 14:43:21 +0100 [thread overview]
Message-ID: <20230303134321.10870-1-jmaselbas@kalray.eu> (raw)
The dwc2 driver private structure wasn't freed in the error path.
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
drivers/usb/dwc2/dwc2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc2/dwc2.c b/drivers/usb/dwc2/dwc2.c
index ef957534c9..ff4842ce62 100644
--- a/drivers/usb/dwc2/dwc2.c
+++ b/drivers/usb/dwc2/dwc2.c
@@ -92,11 +92,10 @@ static int dwc2_probe(struct device *dev)
set_params_cb set_params;
int ret;
- dwc2 = xzalloc(sizeof(*dwc2));
-
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
+ dwc2 = xzalloc(sizeof(*dwc2));
dwc2->regs = IOMEM(iores->start);
dwc2->dev = dev;
@@ -177,6 +176,8 @@ clk_put:
release_region:
release_region(iores);
+ free(dwc2);
+
return ret;
}
--
2.17.1
next reply other threads:[~2023-03-03 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 13:43 Jules Maselbas [this message]
2023-03-03 13:50 ` 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=20230303134321.10870-1-jmaselbas@kalray.eu \
--to=jmaselbas@kalray.eu \
--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