* [PATCH] PCI: Remove useless WARN_ON() from devres
@ 2025-12-18 9:28 Philipp Stanner
2026-01-14 13:10 ` Philipp Stanner
2026-01-14 17:00 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Stanner @ 2025-12-18 9:28 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Philipp Stanner, Guenter Roeck
PCI's devres implementation contains a WARN_ON() which served to inform
users relying on the legacy devres iomap table that this table does not
support multiple mappings per BAR.
The WARN_ON() can be regarded as useless by now, since mapping a BAR
multiple times is legal behavior and old users of pcim_iomap_table(),
the accessor function for that table, did not break in the past PCI
devres cleanup. New PCI users will hopefully notice that
pcim_iomap_table() is deprecated and are unlikely to use it for mapping
the same BAR multiple times.
Moreover, WARN_ON()s create noisy, difficult to read error messages
which can be more confusing than helpful, since they don't inform the
user about what precisely the problem is.
Remove the WARN_ON().
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
drivers/pci/devres.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 9f4190501395..f075e7881c3a 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -469,9 +469,6 @@ static int pcim_add_mapping_to_legacy_table(struct pci_dev *pdev,
if (!legacy_iomap_table)
return -ENOMEM;
- /* The legacy mechanism doesn't allow for duplicate mappings. */
- WARN_ON(legacy_iomap_table[bar]);
-
legacy_iomap_table[bar] = mapping;
return 0;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: Remove useless WARN_ON() from devres
2025-12-18 9:28 [PATCH] PCI: Remove useless WARN_ON() from devres Philipp Stanner
@ 2026-01-14 13:10 ` Philipp Stanner
2026-01-14 17:00 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Stanner @ 2026-01-14 13:10 UTC (permalink / raw)
To: Philipp Stanner, Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Guenter Roeck
On Thu, 2025-12-18 at 10:28 +0100, Philipp Stanner wrote:
> PCI's devres implementation contains a WARN_ON() which served to inform
> users relying on the legacy devres iomap table that this table does not
> support multiple mappings per BAR.
>
> The WARN_ON() can be regarded as useless by now, since mapping a BAR
> multiple times is legal behavior and old users of pcim_iomap_table(),
> the accessor function for that table, did not break in the past PCI
> devres cleanup. New PCI users will hopefully notice that
> pcim_iomap_table() is deprecated and are unlikely to use it for mapping
> the same BAR multiple times.
>
> Moreover, WARN_ON()s create noisy, difficult to read error messages
> which can be more confusing than helpful, since they don't inform the
> user about what precisely the problem is.
>
> Remove the WARN_ON().
>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
*ping*
> ---
> drivers/pci/devres.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
> index 9f4190501395..f075e7881c3a 100644
> --- a/drivers/pci/devres.c
> +++ b/drivers/pci/devres.c
> @@ -469,9 +469,6 @@ static int pcim_add_mapping_to_legacy_table(struct pci_dev *pdev,
> if (!legacy_iomap_table)
> return -ENOMEM;
>
> - /* The legacy mechanism doesn't allow for duplicate mappings. */
> - WARN_ON(legacy_iomap_table[bar]);
> -
> legacy_iomap_table[bar] = mapping;
>
> return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: Remove useless WARN_ON() from devres
2025-12-18 9:28 [PATCH] PCI: Remove useless WARN_ON() from devres Philipp Stanner
2026-01-14 13:10 ` Philipp Stanner
@ 2026-01-14 17:00 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2026-01-14 17:00 UTC (permalink / raw)
To: Philipp Stanner; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Guenter Roeck
On Thu, Dec 18, 2025 at 10:28:20AM +0100, Philipp Stanner wrote:
> PCI's devres implementation contains a WARN_ON() which served to inform
> users relying on the legacy devres iomap table that this table does not
> support multiple mappings per BAR.
>
> The WARN_ON() can be regarded as useless by now, since mapping a BAR
> multiple times is legal behavior and old users of pcim_iomap_table(),
> the accessor function for that table, did not break in the past PCI
> devres cleanup. New PCI users will hopefully notice that
> pcim_iomap_table() is deprecated and are unlikely to use it for mapping
> the same BAR multiple times.
>
> Moreover, WARN_ON()s create noisy, difficult to read error messages
> which can be more confusing than helpful, since they don't inform the
> user about what precisely the problem is.
>
> Remove the WARN_ON().
>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
Applied to pci/misc for v6.20, thanks!
> ---
> drivers/pci/devres.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
> index 9f4190501395..f075e7881c3a 100644
> --- a/drivers/pci/devres.c
> +++ b/drivers/pci/devres.c
> @@ -469,9 +469,6 @@ static int pcim_add_mapping_to_legacy_table(struct pci_dev *pdev,
> if (!legacy_iomap_table)
> return -ENOMEM;
>
> - /* The legacy mechanism doesn't allow for duplicate mappings. */
> - WARN_ON(legacy_iomap_table[bar]);
> -
> legacy_iomap_table[bar] = mapping;
>
> return 0;
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-14 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18 9:28 [PATCH] PCI: Remove useless WARN_ON() from devres Philipp Stanner
2026-01-14 13:10 ` Philipp Stanner
2026-01-14 17:00 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox