From: Sascha Hauer <sha@pengutronix.de>
To: Jules Maselbas <jmaselbas@kalray.eu>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] usb: dwc2: Fix memory leak in probe error path
Date: Fri, 3 Mar 2023 14:50:43 +0100 [thread overview]
Message-ID: <20230303135043.GW32097@pengutronix.de> (raw)
In-Reply-To: <20230303134321.10870-1-jmaselbas@kalray.eu>
On Fri, Mar 03, 2023 at 02:43:21PM +0100, Jules Maselbas wrote:
> 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(-)
Applied, thanks
Sascha
>
> 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
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2023-03-03 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 13:43 Jules Maselbas
2023-03-03 13:50 ` Sascha Hauer [this message]
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=20230303135043.GW32097@pengutronix.de \
--to=sha@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jmaselbas@kalray.eu \
/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