Re: git: 4358928e235c - main - amd64 loader: plug hard hang with serial console enabled

From: Gary Jennejohn <garyj_at_gmx.de>
Date: Sat, 01 Apr 2023 09:38:48 UTC
On Fri, 31 Mar 2023 18:23:24 GMT
Gleb Smirnoff <glebius@FreeBSD.org> wrote:

> The branch main has been updated by glebius:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=4358928e235c1e188ad6b4650d78bcceb225b909
>
> commit 4358928e235c1e188ad6b4650d78bcceb225b909
> Author:     Gleb Smirnoff <glebius@FreeBSD.org>
> AuthorDate: 2023-03-31 18:19:25 +0000
> Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
> CommitDate: 2023-03-31 18:19:25 +0000
>
>     amd64 loader: plug hard hang with serial console enabled
>
>     The hang basically bricks a physical box and it can be recovered
>     only if you are able to boot from alternate media.  This isn't a
>     perfect fix, but throw it in before loader experts decide on
>     proper one.
>
>     Submitted by:   whu
>     Fixes:          927358dd98cb902160093e0dc0bac002d6b43858
> ---
>  stand/efi/loader/efiserialio.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efiserialio.c
> index 5fbc700f6ac2..0f37ef8b87dd 100644
> --- a/stand/efi/loader/efiserialio.c
> +++ b/stand/efi/loader/efiserialio.c
> @@ -265,6 +265,8 @@ comc_probe(struct console *sc)
>  	 */
>  	env = getenv("smbios.bios.version");
>  	if (env == NULL || strncmp(env, "Hyper-V", 7) != 0) {
> +		/* Disable being seen as "comconsole". */
> +		comconsole.c_name = "efiserialio";
>  		return;
>  	}
>  #endif
>

What if env is NULL?  Shouldn't the code return without changing anything?

Seems to me that this if() should be split into two if() clauses.

--
Gary Jennejohn