On 9/9/2025 5:39 PM, Dong Yibo wrote:
> Add fundamental firmware (FW) communication operations via PF-FW mailbox,
> including:
> - FW sync (via HW info query with retries)
> - HW reset (post FW command to reset hardware)
> - MAC address retrieval (request FW for port-specific MAC)
> - Power management (powerup/powerdown notification to FW)
> 
> Signed-off-by: Dong Yibo <[email protected]>
> ---

> +/**
> + * mucse_mbx_sync_fw - Try to sync with fw
> + * @hw: pointer to the HW structure
> + *
> + * mucse_mbx_sync_fw tries to sync with fw. It is only called in
> + * probe. Nothing (register network) todo if failed.
> + * Try more times to do sync.
> + *
> + * Return: 0 on success, negative errno on failure
> + **/
> +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.

-- 
Thanks and Regards,
Md Danish Anwar


Reply via email to