mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Douglas Anderson <dianders@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Brown <broonie@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: serial: qcom-geni-serial: Fix %lu -> %u in print statements
Date: Thu, 4 Aug 2022 09:00:26 +0200	[thread overview]
Message-ID: <e49e5b1f-d178-3e39-87f1-1cccba31ace1@kernel.org> (raw)
In-Reply-To: <20220802132250.1.Iea061e14157a17e114dbe2eca764568a02d6b889@changeid>

On 02. 08. 22, 22:23, Douglas Anderson wrote:
> When we multiply an unsigned int by a u32 we still end up with an
> unsigned int. That means we should specify "%u" not "%lu" in the
> format code.
> 
> NOTE: this fix was chosen instead of somehow promoting the value to
> "unsigned long" since the max baud rate from the earlier call to
> uart_get_baud_rate() is 4000000 and the max sampling rate is 32.
> 4000000 * 32 = 0x07a12000, not even close to overflowing 32-bits.

Acked-by: Jiri Slaby <jirislaby@kernel.org>

I wonder, how this became unnoticed by the 0day bot?

> Fixes: c474c775716e ("tty: serial: qcom-geni-serial: Fix get_clk_div_rate() which otherwise could return a sub-optimal clock rate.")
> Reported-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>   drivers/tty/serial/qcom_geni_serial.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index f754619451dc..f7c1f1807040 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1033,12 +1033,12 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
>   		sampling_rate, &clk_div);
>   	if (!clk_rate) {
>   		dev_err(port->se.dev,
> -			"Couldn't find suitable clock rate for %lu\n",
> +			"Couldn't find suitable clock rate for %u\n",
>   			baud * sampling_rate);
>   		goto out_restart_rx;
>   	}
>   
> -	dev_dbg(port->se.dev, "desired_rate-%lu, clk_rate-%lu, clk_div-%u\n",
> +	dev_dbg(port->se.dev, "desired_rate-%u, clk_rate-%lu, clk_div-%u\n",
>   			baud * sampling_rate, clk_rate, clk_div);
>   
>   	uport->uartclk = clk_rate;


-- 
js
suse labs

      reply	other threads:[~2022-08-04  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 20:23 Douglas Anderson
2022-08-04  7:00 ` Jiri Slaby [this message]

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=e49e5b1f-d178-3e39-87f1-1cccba31ace1@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=quic_vnivarth@quicinc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®