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

From: Geert Uytterhoeven

Date: Wed Apr 22 2026 - 05:00:30 EST


Hi Biju,

On Wed, 22 Apr 2026 at 09:26, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> > On Mon, 20 Apr 2026 at 16:04, Biju <biju.das.au@xxxxxxxxx> wrote:
> > > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > >
> > > On DT systems, a zero baud rate from uart_get_baud_rate() is not
> > > 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 <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > > --- 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.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds