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

Jiri Slaby <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-serial
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.