[PATCH v2 1/3] PCI: of: make a flags argument optional
From: Alex Elder
Date: Wed Sep 09 2026 - 22:20:22 EST
The address of a u32 object is passed to of_pci_get_addr_flags() so
it can be filled with the computed flags value.
Allow a null pointer to be passed, so that the validity of the
resource's flags can be checked without filling in the flags value.
Signed-off-by: Alex Elder <elder@xxxxxxxxxxxx>
---
v2: - Moved this patch to this series
drivers/pci/of_property.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 1e5d7dde467b8..a6c0cca986bdc 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -82,9 +82,11 @@ static int of_pci_get_addr_flags(const struct resource *res, u32 *flags)
else
return -EINVAL;
- *flags = FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss);
- if (res->flags & IORESOURCE_PREFETCH)
- *flags |= OF_PCI_ADDR_FIELD_PREFETCH;
+ if (flags) {
+ *flags = FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss);
+ if (res->flags & IORESOURCE_PREFETCH)
+ *flags |= OF_PCI_ADDR_FIELD_PREFETCH;
+ }
return 0;
}
--
2.53.0