Re: [PATCH v2 2/4] serial: 8250_dw: Only accept a contiguous DLF readback
From: Andy Shevchenko
Date: Wed Oct 21 2026 - 02:50:04 EST
On Tue, Oct 20, 2026 at 04:02:29PM +0300, Ilpo Järvinen wrote:
> On Tue, 20 Oct 2026, Vinicius Pedrosa wrote:
> > On Tue, 20 Oct 2026, Ilpo Järvinen wrote:
> >
> > > For is_power_of_2(), 0 is not a power of two. And it also wouldn't make
> > > sense to have zero bits in the bit field as it's same as no bit field so
> > > using just is_power_of_2() should be enough.
> >
> > I think the reg != 0 check still needs to stay here, since the test is
> > is_power_of_2(reg + 1), rather than is_power_of_2(reg).
> >
> > For reg == 0, reg + 1 is 1, and is_power_of_2(1) is true. So without
> > the explicit reg check, a zero readback, meaning no DLF, would be
> > accepted as a valid DLF.
> >
> > I'll keep it as:
> >
> > reg && is_power_of_2(reg + 1)
> >
> > in v3.
>
> Ah, you're right.
Sorry for being unclear, yes, that's what I meant, reg != 0 should stay.
--
With Best Regards,
Andy Shevchenko