RE: [PATCH v3 2/3] serial: sh-sci: Drop check for zero baud rate from uart_get_baud_rate()

Biju Das <[email protected]> Mon, 20 Jul 2026 16:33:38 +0000
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel,org.kernel.vger.linux-renesas-soc
Message-ID <TY3PR01MB11346FBC3C68B5B970962FB4C86C32@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Hi Hugo,

> -----Original Message-----
> From: Hugo Villeneuve <[email protected]>
> Sent: 20 July 2026 16:48
> Subject: Re: [PATCH v3 2/3] serial: sh-sci: Drop check for zero baud rate from uart_get_baud_rate()
> 
> On Wed, 22 Apr 2026 10:05:38 -0400
> Hugo Villeneuve <[email protected]> wrote:
> 
> > Hi,
> >
> > On Wed, 22 Apr 2026 10:59:23 +0200
> > Geert Uytterhoeven <[email protected]> wrote:
> >
> > > Hi Biju,
> > >
> > > On Wed, 22 Apr 2026 at 09:26, Biju Das <[email protected]> wrote:
> > > > > From: Geert Uytterhoeven <[email protected]> On Mon, 20 Apr
> > > > > 2026 at 16:04, Biju <[email protected]> wrote:
> > > > > > From: Biju Das <[email protected]>
> > > > > >
> > > > > > On DT systems, a zero baud rate from uart_get_baud_rate() is
> > > > > > not
> >
> > The fact that uart_get_baud_rate() cannot return zero is not related
> > to the system using DT or not, so I would drop this "On DT systems, "
> > from the commit message.
> >
> > > > > > possible even earlycon derives its bit rate from chosen/stdout-path.
> > > > > > The zero baud guard and its associated done label are therefore dead code. So remove it.
> > > > > >
> > > > > > Also drop the unused done label from rsci_set_termios().
> > > > > >
> > > > > > Signed-off-by: Biju Das <[email protected]>
> > > > >
> > > > > > --- a/drivers/tty/serial/sh-sci.c
> > > > > > +++ b/drivers/tty/serial/sh-sci.c
> > > > > > @@ -2719,8 +2719,6 @@ static void sci_set_termios(struct uart_port *port, struct ktermios
> *termios,
> > > > > >                 max_freq = max(max_freq, s->clk_rates[i]);
> > > > > >
> > > > > >         baud = uart_get_baud_rate(port, termios, old, 0, max_freq / min_sr(s));
> > > > > > -       if (!baud)
> > > > > > -               goto done;
> > > > > >
> > > > > >         /*
> > > > > >          * There can be multiple sources for the sampling
> > > > > > clock.  Find the one
> > > > >
> > > > > I am afraid you are missing that sh-sci is also used on SH, without DT?
> > > >
> > > > Ok, please share your thoughts to handle divide_by_zero fault for
> > > > SH platforms on the code path after done label??
> > >
> > > Someone has to check on an SH platform (or qemu rts7751r2d) if this
> > > can happen. It might have been broken along the road, as people only
> > > use earlyprintk when debugging a problem that requires it.
> >
> > Geert: this "goto done" is not related to the earlyprintk block, which
> > is untouched by this patch?
> 
> Hi Biju,
> I cannot see any follow-up for these patches. My series for "serial:
> core: improve safety of uart_get_baud_rate()" has been accepted and integrated, so now the renesas sh-sci
> and rsci are the only drivers still checking (for nothing) the zero return value of uart_get_baud_rate().
> 
> I plan on sending two patches to address only that for sh-sci and rsci, unless you are preparing a new
> serie that includes it?

Ack. I am busy with RZ/G3L SDHI/USB/DU work. Please go ahead with your patches.

Cheers,
Biju