public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v1 1/2] usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count
Date: Tue, 3 Jan 2023 11:28:54 +0200	[thread overview]
Message-ID: <Y7P1VlECj5XwBNyP@kuha.fi.intel.com> (raw)
In-Reply-To: <20230102202933.15968-1-andriy.shevchenko@linux.intel.com>

On Mon, Jan 02, 2023 at 10:29:32PM +0200, Andy Shevchenko wrote:
> When acpi_dev_get_memory_resources() fails, the reference count is
> left bumped. Drop it as it's done in the other error paths.
> 
> Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
>  drivers/usb/typec/mux/intel_pmc_mux.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index fdbf3694e21f..87e2c9130607 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -614,8 +614,10 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)
>  
>  	INIT_LIST_HEAD(&resource_list);
>  	ret = acpi_dev_get_memory_resources(adev, &resource_list);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		acpi_dev_put(adev);
>  		return ret;
> +	}
>  
>  	rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node);
>  	if (rentry)
> -- 
> 2.35.1

thanks,

-- 
heikki

      parent reply	other threads:[~2023-01-03  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 20:29 [PATCH v1 1/2] usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count Andy Shevchenko
2023-01-02 20:29 ` [PATCH v1 2/2] usb: typec: intel_pmc_mux: Deduplicate ACPI matching in probe Andy Shevchenko
2023-01-03  9:29   ` Heikki Krogerus
2023-01-03  9:28 ` 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=Y7P1VlECj5XwBNyP@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.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