Re: [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Sep 2025 19:59:11 +0530 Anwar, Md Danish wrote:
> > +int mucse_mbx_sync_fw(struct mucse_hw *hw)
> > +{
> > +	int try_cnt = 3;
> > +	int err;
> > +
> > +	do {
> > +		err = mucse_mbx_get_info(hw);
> > +		if (err == -ETIMEDOUT)
> > +			continue;
> > +		break;
> > +	} while (try_cnt--);
> > +
> > +	return err;
> > +}  
> 
> There's a logical issue in the code. The loop structure attempts to
> retry on ETIMEDOUT errors, but the unconditional break statement after
> the if-check will always exit the loop after the first attempt,
> regardless of the error. The do-while loop will never actually retry
> because the break statement is placed outside of the if condition that
> checks for timeout errors.

The other way around. continue; in a do {} while () look does *not*
evaluate the condition. So this can loop forever.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux