Re: [PATCH v2 2/2] serial: 8250: Add Airoha SoC UART and HSUART support

From: Jiri Slaby

Date: Fri Aug 07 2026 - 00:55:41 EST


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