All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: dmukhin@ford.com
Cc: Jonathan Corbet <corbet@lwn.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86/early_printk: add MMIO-based UARTs
Date: Mon, 17 Mar 2025 08:58:41 +0100	[thread overview]
Message-ID: <Z9fWMaX25c8GIaQK@gmail.com> (raw)
In-Reply-To: <20250314-earlyprintk-v2-1-2bcbe05290b8@ford.com>


* Denis Mukhin via B4 Relay <devnull+dmukhin.ford.com@kernel.org> wrote:

> +	if (!strncmp(s, "nocfg", 5))
> +		baudrate = 0;
> +	else {
> +		baudrate = simple_strtoul(s, &e, 0);
> +		if (baudrate == 0 || s == e)
> +			baudrate = DEFAULT_BAUD;
> +	}

In standard kernel coding style we always balance curly braces and 
don't skip them in the single-statement case. Ie. the above should be:

	if (!strncmp(s, "nocfg", 5)) {
		baudrate = 0;
	} else {


> +	if (baudrate)
> +		early_serial_hw_init(115200 / baudrate);

Hm, I think that division will go poorly if 'baudrate' ends up being 0 
in the 'nocfg' case ... ;-)

Thanks,

	Ingo

  reply	other threads:[~2025-03-17  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 20:09 [PATCH v2] x86/early_printk: add MMIO-based UARTs Denis Mukhin
2025-03-14 20:09 ` Denis Mukhin via B4 Relay
2025-03-17  7:58 ` Ingo Molnar [this message]
2025-03-18 23:39   ` Denis Mukhin
2025-03-19 22:16     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9fWMaX25c8GIaQK@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dmukhin@ford.com \
    --cc=hpa@zytor.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.