On Fri, 2020-06-26 at 17:44 +0000, Brady, Alan wrote:
> > -----Original Message-----
> > From: Joe Perches <[email protected]>
> > Sent: Thursday, June 25, 2020 7:58 PM
> > To: Kirsher, Jeffrey T <[email protected]>; [email protected]
> > Cc: Michael, Alice <[email protected]>; [email protected];
> > [email protected]; [email protected]; Brady, Alan
> > <[email protected]>; Burra, Phani R <[email protected]>; Hay,
> > Joshua A <[email protected]>; Chittim, Madhu
> > <[email protected]>; Linga, Pavan Kumar
> > <[email protected]>; Skidmore, Donald C
> > <[email protected]>; Brandeburg, Jesse
> > <[email protected]>; Samudrala, Sridhar
> > <[email protected]>
> > Subject: Re: [net-next v3 06/15] iecm: Implement mailbox functionality
> >
> > On Thu, 2020-06-25 at 19:07 -0700, Jeff Kirsher wrote:
> > > From: Alice Michael <[email protected]>
> > >
> > > Implement mailbox setup, take down, and commands.
> > []
> > > diff --git a/drivers/net/ethernet/intel/iecm/iecm_controlq.c
> > > b/drivers/net/ethernet/intel/iecm/iecm_controlq.c
> > []
> > > @@ -73,7 +142,74 @@ enum iecm_status iecm_ctlq_add(struct iecm_hw
> > *hw,
> > > struct iecm_ctlq_create_info *qinfo,
> > > struct iecm_ctlq_info **cq)
> >
> > Multiple functions using **cp and *cp can be error prone.
> >
>
> We can see how this can be confusing. Would it be acceptable/sufficient to
> change function parameter name to **cq_arr or **cq_list?
Your code, your choice.
> > > {
> > > - /* stub */
> > > + enum iecm_status status = 0;
> > > + bool is_rxq = false;
> > > +
> > > + if (!qinfo->len || !qinfo->buf_size ||
> > > + qinfo->len > IECM_CTLQ_MAX_RING_SIZE ||
> > > + qinfo->buf_size > IECM_CTLQ_MAX_BUF_LEN)
> > > + return IECM_ERR_CFG;
> > > +
> > > + *cq = kcalloc(1, sizeof(struct iecm_ctlq_info), GFP_KERNEL);
> > > + if (!(*cq))
> > > + return IECM_ERR_NO_MEMORY;
You might use a temporary here after the alloc
struct iecm_ctlq_info *cq;
[...]
*cq_arr = kcalloc(1, sizeof(struct iecm_ctlq_info), GFP_KERNEL);
if (!*cq_arr)
return IECM_ERR_NO_MEMORY;
cq = *cq_arr;
so all uses of cq are consistent.