diff --git a/base/pf-bb-config/centos/pf-bb-config.spec b/base/pf-bb-config/centos/pf-bb-config.spec index b2ebbfdde..4d9e4c4f3 100644 --- a/base/pf-bb-config/centos/pf-bb-config.spec +++ b/base/pf-bb-config/centos/pf-bb-config.spec @@ -10,6 +10,7 @@ Packager: Wind River URL: https://github.com/intel/pf-bb-config/tree/v21.6 Source0: %{name}-%{git_sha}.tar.gz Patch0: Reject-device-configuration-if-not-enabled.patch +Patch1: Fix-check-return-of-configure_device.patch BuildRequires: gcc BuildRequires: inih @@ -23,6 +24,7 @@ space and sets the various parameters through memory-mapped IO read/writes. %prep %setup %patch0 -p1 +%patch1 -p1 %build make diff --git a/base/pf-bb-config/files/Fix-check-return-of-configure_device.patch b/base/pf-bb-config/files/Fix-check-return-of-configure_device.patch new file mode 100644 index 000000000..598e4a66a --- /dev/null +++ b/base/pf-bb-config/files/Fix-check-return-of-configure_device.patch @@ -0,0 +1,49 @@ +From 9d2809308feb10bc74130cea0b677be0bbe3f2dd Mon Sep 17 00:00:00 2001 +From: Douglas Henrique Koerich +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 +--- + 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 +