mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Abdel Alkuor <abdelalkuor@geotab.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: typec: tps6598x: Fix a memory leak in an error handling path
Date: Mon, 30 Oct 2023 11:19:33 +0200	[thread overview]
Message-ID: <ZT91JeJPKdKNy6Ih@kuha.fi.intel.com> (raw)
In-Reply-To: <23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr>

On Mon, Oct 30, 2023 at 07:56:40AM +0100, Christophe JAILLET wrote:
> All error handling end to the error handling path, except these ones.
> Go to 'release_fw' as well here, otherwise 'fw' is leaking.
> 
> Fixes: 7e7a3c815d22 ("USB: typec: tps6598x: Add TPS25750 support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tipd/core.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 0e867f531d34..b0184be06c3d 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -968,16 +968,17 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps)
>  	ret = of_property_match_string(np, "reg-names", "patch-address");
>  	if (ret < 0) {
>  		dev_err(tps->dev, "failed to get patch-address %d\n", ret);
> -		return ret;
> +		goto release_fw;
>  	}
>  
>  	ret = of_property_read_u32_index(np, "reg", ret, &addr);
>  	if (ret)
> -		return ret;
> +		goto release_fw;
>  
>  	if (addr == 0 || (addr >= 0x20 && addr <= 0x23)) {
>  		dev_err(tps->dev, "wrong patch address %u\n", addr);
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto release_fw;
>  	}
>  
>  	bpms_data.addr = (u8)addr;
> -- 
> 2.34.1

-- 
heikki

      reply	other threads:[~2023-10-30  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30  6:56 Christophe JAILLET
2023-10-30  9:19 ` Heikki Krogerus [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=ZT91JeJPKdKNy6Ih@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abdelalkuor@geotab.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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

all inboxes | Powered by JetHome®