Hi,

14.01.2020, 12:25, "Gerd Hoffmann" <kra...@redhat.com>:
> 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 <kra...@redhat.com>

Reviewed-by: Alexey Kirillov <lekir...@yandex-team.ru>

> ---
>  src/boot.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/boot.c b/src/boot.c
> index 5182ab426b9f..afeb36a3319a 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)
> --
> 2.18.1

-- 
Alexey Kirillov
Yandex.Cloud
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to