Patch pf-bb-config to return -1 on failed config
Current implementation of pf-bb-config utility (tag 21.6) does not check the result of configure_device() function. Thus, if pf-bb-config is running in a script or automated procedure (like when applying a puppet manifest), any configuration failure cannot be detected unless the output is parsed. This change patches the source code of pf-bb-config in the same way that was proposed by the PR: https://github.com/intel/pf-bb-config/pull/3. If that change is merged, then in the future when pf-bb-config is upgraded the patch can be removed. Task: 42877 Story: 2009036 Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com> Change-Id: Ic0ec0c7b9088a573cadf468839be1c4445d7abb2
This commit is contained in:
parent
6279c4122c
commit
7fb6fca841
@ -10,6 +10,7 @@ Packager: Wind River <info@windriver.com>
|
|||||||
URL: https://github.com/intel/pf-bb-config/tree/v21.6
|
URL: https://github.com/intel/pf-bb-config/tree/v21.6
|
||||||
Source0: %{name}-%{git_sha}.tar.gz
|
Source0: %{name}-%{git_sha}.tar.gz
|
||||||
Patch0: Reject-device-configuration-if-not-enabled.patch
|
Patch0: Reject-device-configuration-if-not-enabled.patch
|
||||||
|
Patch1: Fix-check-return-of-configure_device.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: inih
|
BuildRequires: inih
|
||||||
@ -23,6 +24,7 @@ space and sets the various parameters through memory-mapped IO read/writes.
|
|||||||
%prep
|
%prep
|
||||||
%setup
|
%setup
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make
|
make
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user