All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 03/13] PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize()
Date: Mon, 16 Nov 2026 15:32:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-217288@kernel.org> (raw)
In-Reply-To: <20261116152403.2672-4-ilpo.jarvinen@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] PCI: guard() mixed with goto cleanup in
  pci_do_resource_release_and_resize()
--

commit 07aa8866ad5508b25df182c6f66b51bc1b05efd3
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize()

This commit replaces the manual down_read() and up_read() calls on
pci_bus_sem in pci_do_resource_release_and_resize() with
guard(rwsem_read).

> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 29ec9ba59d928..f95f217f94e69 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -2398,7 +2398,7 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size
>  	if (ret)
>  		return ret;
>  
> -	down_read(&pci_bus_sem);
> +	guard(rwsem_read)(&pci_bus_sem);
>  
>  	pci_dev_for_each_resource(pdev, r, i) {
>  		if (i >= PCI_BRIDGE_RESOURCES)
> @@ -2435,7 +2435,6 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size
>  	}
>  
>  out:
> -	up_read(&pci_bus_sem);
>  	pci_dev_res_free_list(&saved);
>  	return ret;
>  

[Severity: Low]
This isn't a bug, but using guard(rwsem_read) here mixes scope-based
cleanup with the existing goto restore and goto out unwind paths in
pci_do_resource_release_and_resize(), contrary to the include/linux/cleanup.h
guidelines against mixing guard() and goto error handling in the same
function.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116152403.2672-1-ilpo.jarvinen@linux.intel.com?part=3

  reply	other threads:[~2026-11-16 15:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:23 [PATCH 00/13] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 01/13] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-16 15:35   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-16 15:37   ` sashiko-bot
2026-11-16 19:50   ` Magnus Lindholm
2026-11-16 20:15     ` Ilpo Järvinen
2026-11-16 22:11       ` Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 03/13] PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize() Ilpo Järvinen
2026-11-16 15:32   ` sashiko-bot [this message]
2026-11-16 15:23 ` [PATCH 04/13] PCI: Hold pci_bus_sem across sizing and assignment entrypoints Ilpo Järvinen
2026-11-16 15:36   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 05/13] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-16 16:00   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 06/13] i82875p_edac: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
2026-11-16 15:36   ` sashiko-bot
2026-11-16 15:40   ` Borislav Petkov
2026-11-16 17:11     ` Luck, Tony
2026-11-17 19:54       ` Borislav Petkov
2026-11-17 20:14         ` Luck, Tony
2026-11-18  0:46           ` Borislav Petkov
2026-11-18  6:19             ` Borislav Petkov
2026-11-16 15:23 ` [PATCH 07/13] platform/x86: asus-wmi: " Ilpo Järvinen
2026-11-16 15:30   ` sashiko-bot
2026-11-17  2:43   ` Denis Benato
2026-11-16 15:23 ` [PATCH 08/13] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-16 15:29   ` sashiko-bot
2026-11-17  2:52   ` Denis Benato
2026-11-16 15:23 ` [PATCH 09/13] parisc/PCI: " Ilpo Järvinen
2026-11-16 15:45   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 10/13] PCI: hotplug: octep: " Ilpo Järvinen
2026-11-16 15:38   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 11/13] PCI: ftpci100: " Ilpo Järvinen
2026-11-16 15:34   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 12/13] PCI: hv: " Ilpo Järvinen
2026-11-16 15:35   ` sashiko-bot
2026-11-16 15:23 ` [PATCH 13/13] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
2026-11-16 15:36   ` sashiko-bot

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=sashiko-outbox-217288@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.