Re: [PATCH v2 2/4] serial: 8250_dw: Only accept a contiguous DLF readback

From: Ilpo Järvinen

Date: Tue Oct 20 2026 - 09:12:11 EST


On Tue, 20 Oct 2026, Vinicius Pedrosa wrote:

> Hi Ilpo,
>
> 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.

--
i.