Re: [PATCH v2 03/15] net: rnpgbe: Add basic mbx ops support
From: Yibo Dong
Date: Tue Jul 22 2025 - 23:08:56 EST
On Tue, Jul 22, 2025 at 12:35:42PM +0100, Simon Horman wrote:
> On Mon, Jul 21, 2025 at 07:32:26PM +0800, Dong Yibo wrote:
> > Initialize basic mbx function.
> >
> > Signed-off-by: Dong Yibo <dong100@xxxxxxxxx>
>
> ...
>
> > diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c
>
> ...
>
> > +/**
> > + * mucse_obtain_mbx_lock_pf - obtain mailbox lock
> > + * @hw: pointer to the HW structure
> > + * @mbx_id: Id of vf/fw to obtain
> > + *
> > + * This function maybe used in an irq handler.
> > + *
> > + * @return: 0 if we obtained the mailbox lock
> > + **/
> > +static int mucse_obtain_mbx_lock_pf(struct mucse_hw *hw, enum MBX_ID mbx_id)
> > +{
> > + struct mucse_mbx_info *mbx = &hw->mbx;
> > + int try_cnt = 5000, ret;
> > + u32 reg;
> > +
> > + reg = (mbx_id == MBX_FW) ? PF2FW_MBOX_CTRL(mbx) :
> > + PF2VF_MBOX_CTRL(mbx, mbx_id);
> > + while (try_cnt-- > 0) {
> > + /* Take ownership of the buffer */
> > + mbx_wr32(hw, reg, MBOX_PF_HOLD);
> > + /* force write back before check */
> > + wmb();
> > + if (mbx_rd32(hw, reg) & MBOX_PF_HOLD)
> > + return 0;
> > + udelay(100);
> > + }
> > + return ret;
>
> ret is declared, and returned here.
> But it is never initialised.
>
> Perhaps it is appropriate to return an error value here,
> and update the kernel doc for this function accordingly.
>
> Flagged by W=1 builds with Clang 20.1.8, and Smatch.
>
> > +}
>
> ...
>
Got it, I will fix this.
Maybe my clang (10.0.0) is too old, I will update it and
try W=1 again.
Thanks for your feedback.