All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Feng Tang" <feng.tang@linux.alibaba.com>,
	"Jonathan Cameron" <Jonthan.Cameron@huawei.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/6] PCI/portdrv: Fix potential resource leak
Date: Fri, 19 Dec 2025 12:07:23 +0000	[thread overview]
Message-ID: <20251219120723.0000173d@huawei.com> (raw)
In-Reply-To: <e1c68c3b3f1af8427e98ca5e2c79f8bf0ebe2ce4.1764688034.git.u.kleine-koenig@baylibre.com>

On Tue,  2 Dec 2025 16:13:49 +0100
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:

> pcie_port_probe_service() unconditionally calls get_device() (unless it
> fails). So drop that reference also unconditionally as it's fine for a
> pcie driver to not have a remove callback.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> This isn't very urgent as I think there is no pcie driver without a
> remove callback

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  drivers/pci/pcie/portdrv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index d1b68c18444f..f13039378908 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -557,10 +557,10 @@ static int pcie_port_remove_service(struct device *dev)
>  
>  	pciedev = to_pcie_device(dev);
>  	driver = to_service_driver(dev->driver);
> -	if (driver && driver->remove) {
> +	if (driver && driver->remove)
>  		driver->remove(pciedev);
> -		put_device(dev);
> -	}
> +
> +	put_device(dev);
>  	return 0;
>  }
>  


  parent reply	other threads:[~2025-12-19 12:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 15:13 [PATCH 0/6] PCI/portdrv: Use bus-type functions Uwe Kleine-König
2025-12-02 15:13 ` [PATCH 1/6] PCI/portdrv: Fix potential resource leak Uwe Kleine-König
2025-12-11 17:19   ` Ilpo Järvinen
2025-12-19 12:07   ` Jonathan Cameron [this message]
2025-12-02 15:13 ` [PATCH 2/6] PCI/portdrv: Drop empty shutdown callback Uwe Kleine-König
2025-12-02 16:10   ` Uwe Kleine-König
2025-12-11 17:20   ` Ilpo Järvinen
2025-12-19 12:08   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 3/6] PCI/portdrv: Don't check for the driver's and device's bus Uwe Kleine-König
2025-12-19 12:11   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 4/6] PCI/portdrv: Move pcie_port_bus_type to pcie source file Uwe Kleine-König
2025-12-11 17:28   ` Ilpo Järvinen
2025-12-12 22:35     ` Uwe Kleine-König
2026-01-12 10:43       ` Uwe Kleine-König
2025-12-02 15:13 ` [PATCH 5/6] PCI/portdrv: Don't check for valid device and driver in bus callbacks Uwe Kleine-König
2025-12-19 12:12   ` Jonathan Cameron
2025-12-02 15:13 ` [PATCH 6/6] PCI/portdrv: Use bus-type functions Uwe Kleine-König
2025-12-19 12:13   ` Jonathan Cameron
2026-01-13 21:50 ` [PATCH 0/6] " Bjorn Helgaas

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=20251219120723.0000173d@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Jonthan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=feng.tang@linux.alibaba.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=u.kleine-koenig@baylibre.com \
    /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.