From: Jakub Kicinski <kuba@kernel.org>
To: "Anwar, Md Danish" <a0501179@ti.com>
Cc: Dong Yibo <dong100@mucse.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<horms@kernel.org>, <corbet@lwn.net>, <gur.stavi@huawei.com>,
<maddy@linux.ibm.com>, <mpe@ellerman.id.au>, <danishanwar@ti.com>,
<lee@trager.us>, <gongfan1@huawei.com>, <lorenzo@kernel.org>,
<geert+renesas@glider.be>, <Parthiban.Veerasooran@microchip.com>,
<lukas.bulwahn@redhat.com>, <alexanderduyck@fb.com>,
<richardcochran@gmail.com>, <kees@kernel.org>,
<gustavoars@kernel.org>, <rdunlap@infradead.org>,
<vadim.fedorenko@linux.dev>, <netdev@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Tue, 9 Sep 2025 13:58:22 -0700 [thread overview]
Message-ID: <20250909135822.2ac833fc@kernel.org> (raw)
In-Reply-To: <68fc2f5c-2cbd-41f6-a814-5134ba06b4b5@ti.com>
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.
next prev parent reply other threads:[~2025-09-09 20:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 12:09 [PATCH net-next v11 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-09-09 12:09 ` [PATCH net-next v11 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-09-09 12:37 ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-09-09 12:41 ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-09-09 14:22 ` Anwar, Md Danish
2025-09-09 20:55 ` Jakub Kicinski
2025-09-10 5:56 ` Yibo Dong
2025-09-11 1:02 ` Jakub Kicinski
2025-09-11 1:38 ` Yibo Dong
2025-09-10 5:52 ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-09-09 14:29 ` Anwar, Md Danish
2025-09-09 20:58 ` Jakub Kicinski [this message]
2025-09-10 6:08 ` Yibo Dong
2025-09-10 8:21 ` Jörg Sommer
2025-09-11 1:46 ` Yibo Dong
2025-09-11 1:03 ` Jakub Kicinski
2025-09-11 1:41 ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-09-09 14:31 ` Anwar, Md Danish
2025-09-10 6:10 ` Yibo Dong
2025-09-09 14:37 ` Vadim Fedorenko
2025-09-10 6:22 ` Yibo Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250909135822.2ac833fc@kernel.org \
--to=kuba@kernel.org \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=a0501179@ti.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dong100@mucse.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=gongfan1@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=gustavoars@kernel.org \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).