Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: <intel-wired-lan@osuosl.org>
Subject: Re: [Intel-wired-lan] [net-next, v2 2/2] ice: Accumulate ring statistics over reset
Date: Fri, 14 Oct 2022 15:44:08 -0700	[thread overview]
Message-ID: <7b60fd62-e0ca-e417-16ef-23fdbecec277@intel.com> (raw)
In-Reply-To: <20221010192223.916578-3-benjamin.mikailenko@intel.com>



On 10/10/2022 12:22 PM, Benjamin Mikailenko wrote:
> +/**
> + * ice_vsi_alloc_stat_arrays - Allocate statistics arrays
> + * @vsi: VSI pointer
> + */
> +static int ice_vsi_alloc_stat_arrays(struct ice_vsi *vsi)
> +{
> +	struct ice_vsi_stats *vsi_stat;
> +	struct ice_pf *pf = vsi->back;
> +	struct device *dev;
> +
> +	dev = ice_pf_to_dev(pf);
> +
> +	if (vsi->type == ICE_VSI_CHNL)
> +		return 0;
> +	if (!pf->vsi_stats)
> +		return -ENOENT;
> +
> +	vsi_stat = devm_kzalloc(dev, sizeof(*vsi_stat), GFP_KERNEL);
> +	if (!vsi_stat)
> +		return -ENOMEM;
> +
> +	pf->vsi_stats[vsi->idx] = vsi_stat;
> +

This should also be moved to the end of the function so that we don't
modify pf->vsi_stats unless this function succeeds.

> +	vsi_stat->tx_ring_stats =
> +		devm_kcalloc(dev, vsi->alloc_txq,
> +			     sizeof(*vsi_stat->tx_ring_stats), GFP_KERNEL);
> +
> +	vsi_stat->rx_ring_stats =
> +		devm_kcalloc(dev, vsi->alloc_rxq,
> +			     sizeof(*vsi_stat->rx_ring_stats), GFP_KERNEL);
> +
> +	if (!vsi_stat->tx_ring_stats || !vsi_stat->rx_ring_stats)
> +		goto err_alloc;
> +
> +	return 0;
> +
> +err_alloc:
> +	devm_kfree(dev, vsi_stat->tx_ring_stats);
> +	vsi_stat->tx_ring_stats = NULL;
> +	devm_kfree(dev, vsi_stat->rx_ring_stats);
> +	vsi_stat->rx_ring_stats = NULL;
> +	devm_kfree(dev, vsi_stat);
> +	pf->vsi_stats[vsi->idx] = NULL;
> +	return -ENOMEM;
> +}
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

      parent reply	other threads:[~2022-10-14 22:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 19:22 [Intel-wired-lan] [net-next, v2 0/2] ice: Accumulate statistics over reset Benjamin Mikailenko
2022-10-10 19:22 ` [Intel-wired-lan] [net-next, v2 1/2] ice: Accumulate HW and Netdev " Benjamin Mikailenko
2022-10-12 13:37   ` G, GurucharanX
2022-10-10 19:22 ` [Intel-wired-lan] [net-next, v2 2/2] ice: Accumulate ring " Benjamin Mikailenko
2022-10-12 13:38   ` G, GurucharanX
2022-10-14 22:33   ` Jacob Keller
2022-10-14 22:44   ` Jacob Keller [this message]

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=7b60fd62-e0ca-e417-16ef-23fdbecec277@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /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