50 lines
1.3 KiB
Diff
50 lines
1.3 KiB
Diff
From 9d2809308feb10bc74130cea0b677be0bbe3f2dd Mon Sep 17 00:00:00 2001
|
|
From: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
|
|
Date: Tue, 27 Jul 2021 12:31:45 -0400
|
|
Subject: [PATCH] Fix: check return of configure_device()
|
|
|
|
Takes the result of configure_device() as the return code of the
|
|
application, allowing any script running pf-bb-config to stop on
|
|
bad device configuration.
|
|
|
|
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
|
|
---
|
|
config_app.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/config_app.c b/config_app.c
|
|
index f1aa52b..f6dab5e 100644
|
|
--- a/config_app.c
|
|
+++ b/config_app.c
|
|
@@ -390,20 +390,24 @@ main(int argc, char *argv[])
|
|
return -1;
|
|
}
|
|
|
|
+ ret = 0;
|
|
if (device.config_all) {
|
|
for (i = 0; i < num_devices; i++) {
|
|
strncpy(device.pci_address, found_devices[i],
|
|
sizeof(device.pci_address) - NULL_PAD);
|
|
- configure_device(&device);
|
|
+ ret = configure_device(&device);
|
|
+ if (ret != 0) {
|
|
+ break;
|
|
+ }
|
|
}
|
|
} else {
|
|
select_device(&device, found_devices, num_devices);
|
|
- configure_device(&device);
|
|
+ ret = configure_device(&device);
|
|
}
|
|
|
|
/* Free memory for stored PCI slots */
|
|
for (i = 0; i < num_devices; i++)
|
|
free(found_devices[i]);
|
|
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
--
|
|
2.29.2
|
|
|