aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-01-14 09:56:31 +0100
committerGerd Hoffmann <kraxel@redhat.com>2020-01-14 10:15:19 +0100
commit8d4252254a757ef61ca0b3d8fd54a95c2ce5d633 (patch)
tree71f203988234c8305791ef99b80544b30f830a92 /src
parent2f4d068645c211e309812372cd0ac58c9024e93b (diff)
downloadseabios-8d4252254a757ef61ca0b3d8fd54a95c2ce5d633.tar.gz
boot: cache HALT priority
Call find_prio("HALT") only once, on first is_bootprio_strict() call. Store the result in a variable and reuse it on subsequent calls. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/boot.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/boot.c b/src/boot.c
index 5182ab42..afeb36a3 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -297,7 +297,11 @@ find_prio(const char *glob)
u8 is_bootprio_strict(void)
{
- return find_prio("HALT") >= 0;
+ static int prio_halt = -2;
+
+ if (prio_halt == -2)
+ prio_halt = find_prio("HALT");
+ return prio_halt >= 0;
}
int bootprio_find_pci_device(struct pci_device *pci)