All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Shannon Nelson <shannon.nelson@amd.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	idosch@idosch.org, brett.creeley@amd.com, drivers@pensando.io
Subject: Re: [PATCH v3  net-next 2/4] ionic: extract common bits from ionic_probe
Date: Wed, 19 Jul 2023 18:48:23 +0100	[thread overview]
Message-ID: <ZLgh54I53tdedi/y@corigine.com> (raw)
In-Reply-To: <20230717170001.30539-3-shannon.nelson@amd.com>

On Mon, Jul 17, 2023 at 09:59:59AM -0700, Shannon Nelson wrote:
> Pull out some chunks of code from ionic_probe() that will
> be common in rebuild paths.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>

...

> +static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct ionic *ionic;
> +	int num_vfs;
> +	int err;
> +
> +	ionic = ionic_devlink_alloc(dev);
> +	if (!ionic)
> +		return -ENOMEM;
> +
> +	ionic->pdev = pdev;
> +	ionic->dev = dev;
> +	pci_set_drvdata(pdev, ionic);
> +	mutex_init(&ionic->dev_cmd_lock);
> +
> +	/* Query system for DMA addressing limitation for the device. */
> +	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IONIC_ADDR_LEN));
> +	if (err) {
> +		dev_err(dev, "Unable to obtain 64-bit DMA for consistent allocations, aborting.  err=%d\n",
> +			err);
> +		goto err_out;
> +	}
> +
> +	err = ionic_setup_one(ionic);
> +	if (err)
> +		goto err_out;
> +
>  	/* Allocate and init the LIF */
>  	err = ionic_lif_size(ionic);
>  	if (err) {
>  		dev_err(dev, "Cannot size LIF: %d, aborting\n", err);
> -		goto err_out_port_reset;
> +		goto err_out_pci;

Hi Shannon,

Prior to this patch, if this error occurred then the following cleanup
would occur.

	ionic_port_reset(ionic);
	ionic_reset(ionic);
	ionic_dev_teardown(ionic);
	ionic_clear_pci(ionic);
	ionic_debugfs_del_dev(ionic);
	mutex_destroy(&ionic->dev_cmd_lock);
	ionic_devlink_free(ionic);

With this patch I am assuming that the same setup has occurred at
this point (maybe I am mistaken). But with the following cleanup on error.

	ionic_clear_pci(ionic);
	mutex_destroy(&ionic->dev_cmd_lock);
	ionic_devlink_free(ionic);

I feel that I'm reading this wrong.

>  	}
>  
>  	err = ionic_lif_alloc(ionic);
> @@ -354,17 +375,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	ionic->lif = NULL;
>  err_out_free_irqs:
>  	ionic_bus_free_irq_vectors(ionic);
> -err_out_port_reset:
> -	ionic_port_reset(ionic);
> -err_out_reset:
> -	ionic_reset(ionic);
> -err_out_teardown:
> -	ionic_dev_teardown(ionic);
> -err_out_clear_pci:
> +err_out_pci:
>  	ionic_clear_pci(ionic);
> -err_out_debugfs_del_dev:
> -	ionic_debugfs_del_dev(ionic);
> -err_out_clear_drvdata:
> +err_out:
>  	mutex_destroy(&ionic->dev_cmd_lock);
>  	ionic_devlink_free(ionic);
>  
> -- 
> 2.17.1
> 
> 

  reply	other threads:[~2023-07-19 17:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 16:59 [PATCH v3 net-next 0/4] ionic: add FLR support Shannon Nelson
2023-07-17 16:59 ` [PATCH v3 net-next 1/4] ionic: extract common bits from ionic_remove Shannon Nelson
2023-07-19 17:34   ` Simon Horman
2023-07-20  0:04     ` Shannon Nelson
2023-07-17 16:59 ` [PATCH v3 net-next 2/4] ionic: extract common bits from ionic_probe Shannon Nelson
2023-07-19 17:48   ` Simon Horman [this message]
2023-07-20  0:04     ` Shannon Nelson
2023-07-17 17:00 ` [PATCH v3 net-next 3/4] ionic: pull out common bits from fw_up Shannon Nelson
2023-07-19 17:56   ` Simon Horman
2023-07-20  0:04     ` Shannon Nelson
2023-07-17 17:00 ` [PATCH v3 net-next 4/4] ionic: add FLR recovery support Shannon Nelson

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=ZLgh54I53tdedi/y@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --cc=idosch@idosch.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shannon.nelson@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.