Re: [PATCH v2 2/2] serial: 8250: Add Airoha SoC UART and HSUART support
Jiri Slaby <[email protected]> Fri, 7 Aug 2026 06:55:11 +0200
| Newsgroups | org.kernel.vger.linux-serial,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 07. 08. 26, 0:53, Andy Shevchenko wrote:
> On Fri, Jul 24, 2026 at 08:30:06PM +0200, Christian Marangi wrote:
>> + /*
>> + * Calculate XYD_x and XINCLKDR register by searching
>> + * through a table of crystal_clock divisors.
>> + */
>> + nom = baud * XYD_Y;
>
>> + for (i = 0 ; i < ARRAY_SIZE(airoha_clk_div_info) ; i++) {
>> + clk_div_info = &airoha_clk_div_info[i];
>> + xindiv_clk = XINDIV_CLOCK / clk_div_info->div;
>
> for (unsigned int i = ARRAY_SIZE(airoha_clk_div_info) - 1; i >= 0; i--) {
Due to unsignedness, isn't this a lopp for ever?
> xindiv_clk = XINDIV_CLOCK / BIT(i);
>
> Also variant (but may be a little bit confusing)
But a little bit more correct :).
> for (unsigned int i = ARRAY_SIZE(airoha_clk_div_info); i; i--) {
> xindiv_clk = XINDIV_CLOCK / BIT(i - 1);
>
thanks,
--
js
suse labs