All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Daniel Scally <djrscally@gmail.com>,
	Mark Gross <markgross@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-acpi@vger.kernel.org
Subject: Re: [resend, PATCH v1 1/1] platform/x86: int3472: Don't leak reference on error
Date: Tue, 4 Oct 2022 16:11:27 +0200	[thread overview]
Message-ID: <CAJZ5v0j-V3gG3ADr9OigPsK0Rf9Ygd4KdEAkW=re3sd2gf_Awg@mail.gmail.com> (raw)
In-Reply-To: <20221004122636.61755-1-andriy.shevchenko@linux.intel.com>

On Tue, Oct 4, 2022 at 2:26 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The for_each_acpi_consumer_dev() takes a reference to the iterator
> and if we break a loop we must drop that reference. This usually
> happens when error handling is involved. However it's not the case
> for skl_int3472_fill_clk_pdata().
>
> Don't leak reference on error by dropping it properly.
>
> Fixes: 43cf36974d76 ("platform/x86: int3472: Support multiple clock consumers")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> resent to include Rafael and linux-acpi@ to the Cc list
>
>  drivers/platform/x86/intel/int3472/tps68470.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
> index f83e9c393f31..5b8d1a9620a5 100644
> --- a/drivers/platform/x86/intel/int3472/tps68470.c
> +++ b/drivers/platform/x86/intel/int3472/tps68470.c
> @@ -128,15 +128,15 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data
>         for_each_acpi_consumer_dev(adev, consumer) {
>                 sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT,
>                                              acpi_dev_name(consumer));
> -               if (!sensor_name)
> +               if (!sensor_name) {
> +                       acpi_dev_put(consumer);
>                         return -ENOMEM;
> +               }
>
>                 (*clk_pdata)->consumers[i].consumer_dev_name = sensor_name;
>                 i++;
>         }
>
> -       acpi_dev_put(consumer);
> -
>         return n_consumers;
>  }
>
> --

Applied, thanks!

      reply	other threads:[~2022-10-04 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04 12:26 [resend, PATCH v1 1/1] platform/x86: int3472: Don't leak reference on error Andy Shevchenko
2022-10-04 14:11 ` Rafael J. Wysocki [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='CAJZ5v0j-V3gG3ADr9OigPsK0Rf9Ygd4KdEAkW=re3sd2gf_Awg@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=djrscally@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.