lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240501160637.GW2575892@kernel.org>
Date: Wed, 1 May 2024 17:06:37 +0100
From: Simon Horman <horms@...nel.org>
To: Geetha sowjanya <gakula@...vell.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, kuba@...nel.org,
	davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com,
	sgoutham@...vell.com, sbhatta@...vell.com, hkelam@...vell.com
Subject: Re: [net-next PATCH v3 2/9] octeontx2-pf: RVU representor driver

On Sun, Apr 28, 2024 at 04:23:05PM +0530, Geetha sowjanya wrote:
> This patch adds basic driver for the RVU representor.
> Driver on probe does pci specific initialization and does hw
> resources configuration.
> Introduces RVU_ESWITCH kernel config to enable/disable
> this driver. Representor and NIC shares the code but representors
> netdev support subset of NIC functionality. Hence "otx2_rep_dev"
> api helps to skip the features initialization that are not supported
> by the representors.
> 
> Signed-off-by: Geetha sowjanya <gakula@...vell.com>

...

> +static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct otx2_nic *priv;
> +	struct otx2_hw *hw;
> +	int err;
> +
> +	err = pcim_enable_device(pdev);
> +	if (err) {
> +		dev_err(dev, "Failed to enable PCI device\n");
> +		return err;
> +	}
> +
> +	err = pci_request_regions(pdev, DRV_NAME);
> +	if (err) {
> +		dev_err(dev, "PCI request regions failed 0x%x\n", err);
> +		return err;
> +	}
> +
> +	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
> +	if (err) {
> +		dev_err(dev, "DMA mask config failed, abort\n");
> +		goto err_release_regions;
> +	}
> +
> +	pci_set_master(pdev);
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		goto err_release_regions;

Hi Geetha,

This goto will result in the function returning err.
But err is 0 here. Perhaps it should be set to -ENOMEM?

Flagged by Smatch.

> +
> +	pci_set_drvdata(pdev, priv);
> +	priv->pdev = pdev;
> +	priv->dev = dev;
> +	priv->flags |= OTX2_FLAG_INTF_DOWN;
> +	priv->flags |= OTX2_FLAG_REP_MODE_ENABLED;
> +
> +	hw = &priv->hw;
> +	hw->pdev = pdev;
> +	hw->max_queues = OTX2_MAX_CQ_CNT;
> +	hw->rbuf_len = OTX2_DEFAULT_RBUF_LEN;
> +	hw->xqe_size = 128;
> +
> +	err = otx2_init_rsrc(pdev, priv);
> +	if (err)
> +		goto err_release_regions;
> +
> +	err = rvu_get_rep_cnt(priv);
> +	if (err)
> +		goto err_detach_rsrc;
> +
> +	err = rvu_rep_rsrc_init(priv);
> +	if (err)
> +		goto err_detach_rsrc;
> +
> +	return 0;
> +
> +err_detach_rsrc:
> +	if (priv->hw.lmt_info)
> +		free_percpu(priv->hw.lmt_info);
> +	if (test_bit(CN10K_LMTST, &priv->hw.cap_flag))
> +		qmem_free(priv->dev, priv->dync_lmt);
> +	otx2_detach_resources(&priv->mbox);
> +	otx2_disable_mbox_intr(priv);
> +	otx2_pfaf_mbox_destroy(priv);
> +	pci_free_irq_vectors(pdev);
> +err_release_regions:
> +	pci_set_drvdata(pdev, NULL);
> +	pci_release_regions(pdev);
> +	return err;
> +}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ