Subject: Re: [PATCH net-next v2 03/15] idpf: add controlq init and reset checks

From: Simon Horman <[email-masked]>
Date: Tue, 11 Apr 2023 11:19:31 +0200

On Mon, Apr 10, 2023 at 06:13:42PM -0700, Pavan Kumar Linga wrote:
> From: Joshua Hay <[email-masked]>
> 
> At the end of the probe, initialize and schedule the event workqueue.
> It calls the hard reset function where reset checks are done to find
> if the device is out of the reset. Control queue initialization and
> the necessary control queue support is added.
> 
> Introduce function pointers for the register operations which are
> different between PF and VF devices.

...

> +int idpf_ctlq_add(struct idpf_hw *hw,
> +		  struct idpf_ctlq_create_info *qinfo,
> +		  struct idpf_ctlq_info **cq_out)
> +{
> +	struct idpf_ctlq_info *cq;
> +	bool is_rxq = false;
> +	int status = 0;
> +
> +	if (!qinfo->len || !qinfo->buf_size ||
> +	    qinfo->len > IDPF_CTLQ_MAX_RING_SIZE ||
> +	    qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
> +		return -EINVAL;
> +
> +	cq = kcalloc(1, sizeof(struct idpf_ctlq_info), GFP_KERNEL);
> +	if (!cq)
> +		return -ENOMEM;

Hi Pavan, Hi Joshua,

nit: I notice a number of instances in this patchset where either
     the first argument passed to kcalloc() is 1, or the second
     argument is sizeof(u8).

     I think it would be slightly better to use kmalloc() in such cases.