* [PATCH] PCI: rpaphp: report first slot registration error
@ 2026-09-10 12:13 Adriano Cordova
0 siblings, 0 replies; only message in thread
From: Adriano Cordova @ 2026-09-10 12:13 UTC (permalink / raw)
To: Madhavan Srinivasan, Tyrel Datwyler
Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
Bjorn Helgaas, Linas Vepstas, linuxppc-dev, linux-pci,
linux-kernel, Adriano Cordova
rpaphp_drc_add_slot() overwrites retval on every loop iteration, so a
failure to register a slot is lost if a later slot registers
successfully and the function returns success.
Track the first error and return it, while still attempting to register
the remaining slots.
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
drivers/pci/hotplug/rpaphp_core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 2316de0fd198..af7241d526cf 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -376,6 +376,7 @@ static int rpaphp_drc_add_slot(struct device_node *dn)
{
struct slot *slot;
int retval = 0;
+ int first_error = 0;
int i;
const __be32 *indexes, *names, *types, *power_domains;
char *name, *type;
@@ -407,16 +408,18 @@ static int rpaphp_drc_add_slot(struct device_node *dn)
if (!retval)
retval = rpaphp_register_slot(slot);
- if (retval)
+ if (retval) {
+ if (!first_error)
+ first_error = retval;
dealloc_slot_struct(slot);
+ }
name += strlen(name) + 1;
type += strlen(type) + 1;
}
- dbg("%s - Exit: rc[%d]\n", __func__, retval);
+ dbg("%s - Exit: rc[%d]\n", __func__, first_error);
- /* XXX FIXME: reports a failure only if last entry in loop failed */
- return retval;
+ return first_error;
}
/**
--
2.51.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-10 12:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 12:13 [PATCH] PCI: rpaphp: report first slot registration error Adriano Cordova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®