All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Zhu Lingshan <lingshan.zhu@intel.com>,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 2/3] vDPA/ifcvf: implement management netlink framework for ifcvf
Date: Mon, 5 Jul 2021 02:34:50 -0400	[thread overview]
Message-ID: <20210705023354-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1ebb3dc8-5416-f718-2837-8371e78dd3d0@redhat.com>

On Mon, Jul 05, 2021 at 01:04:11PM +0800, Jason Wang wrote:
> > +static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> > +{
> > +	struct ifcvf_vdpa_mgmt_dev *ifcvf_mgmt_dev;
> > +	struct device *dev = &pdev->dev;
> > +	struct ifcvf_adapter *adapter;
> 
> 
> adapter is not used.

It's used in error handling below. It's not *initialized*.

> 
> > +	u32 dev_type;
> > +	int ret;
> > +
> > +	ifcvf_mgmt_dev = kzalloc(sizeof(struct ifcvf_vdpa_mgmt_dev), GFP_KERNEL);
> > +	if (!ifcvf_mgmt_dev) {
> > +		IFCVF_ERR(pdev, "Failed to alloc memory for the vDPA management device\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	dev_type = get_dev_type(pdev);
> > +	switch (dev_type) {
> > +	case VIRTIO_ID_NET:
> > +		ifcvf_mgmt_dev->mdev.id_table = id_table_net;
> > +		break;
> > +	case VIRTIO_ID_BLOCK:
> > +		ifcvf_mgmt_dev->mdev.id_table = id_table_blk;
> > +		break;
> > +	default:
> > +		IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", dev_type);
> > +		ret = -EOPNOTSUPP;
> > +		goto err;
> > +	}
> > +
> > +	ifcvf_mgmt_dev->mdev.ops = &ifcvf_vdpa_mgmt_dev_ops;
> > +	ifcvf_mgmt_dev->mdev.device = dev;
> > +	ifcvf_mgmt_dev->pdev = pdev;
> > +
> > +	ret = pcim_enable_device(pdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "Failed to enable device\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = pcim_iomap_regions(pdev, BIT(0) | BIT(2) | BIT(4),
> > +				 IFCVF_DRIVER_NAME);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "Failed to request MMIO region\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "No usable DMA configuration\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = devm_add_action_or_reset(dev, ifcvf_free_irq_vectors, pdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev,
> > +			  "Failed for adding devres for freeing irq vectors\n");
> > +		goto err;
> > +	}
> > +
> > +	pci_set_master(pdev);
> > +
> > +	ret = vdpa_mgmtdev_register(&ifcvf_mgmt_dev->mdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev,
> > +			  "Failed to initialize the management interfaces\n");
> >   		goto err;
> >   	}
> > @@ -533,14 +610,21 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >   err:
> >   	put_device(&adapter->vdpa.dev);
> > +	kfree(ifcvf_mgmt_dev);
> >   	return ret;
> >   }


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: netdev@vger.kernel.org, Zhu Lingshan <lingshan.zhu@intel.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 2/3] vDPA/ifcvf: implement management netlink framework for ifcvf
Date: Mon, 5 Jul 2021 02:34:50 -0400	[thread overview]
Message-ID: <20210705023354-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1ebb3dc8-5416-f718-2837-8371e78dd3d0@redhat.com>

On Mon, Jul 05, 2021 at 01:04:11PM +0800, Jason Wang wrote:
> > +static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> > +{
> > +	struct ifcvf_vdpa_mgmt_dev *ifcvf_mgmt_dev;
> > +	struct device *dev = &pdev->dev;
> > +	struct ifcvf_adapter *adapter;
> 
> 
> adapter is not used.

It's used in error handling below. It's not *initialized*.

> 
> > +	u32 dev_type;
> > +	int ret;
> > +
> > +	ifcvf_mgmt_dev = kzalloc(sizeof(struct ifcvf_vdpa_mgmt_dev), GFP_KERNEL);
> > +	if (!ifcvf_mgmt_dev) {
> > +		IFCVF_ERR(pdev, "Failed to alloc memory for the vDPA management device\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	dev_type = get_dev_type(pdev);
> > +	switch (dev_type) {
> > +	case VIRTIO_ID_NET:
> > +		ifcvf_mgmt_dev->mdev.id_table = id_table_net;
> > +		break;
> > +	case VIRTIO_ID_BLOCK:
> > +		ifcvf_mgmt_dev->mdev.id_table = id_table_blk;
> > +		break;
> > +	default:
> > +		IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", dev_type);
> > +		ret = -EOPNOTSUPP;
> > +		goto err;
> > +	}
> > +
> > +	ifcvf_mgmt_dev->mdev.ops = &ifcvf_vdpa_mgmt_dev_ops;
> > +	ifcvf_mgmt_dev->mdev.device = dev;
> > +	ifcvf_mgmt_dev->pdev = pdev;
> > +
> > +	ret = pcim_enable_device(pdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "Failed to enable device\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = pcim_iomap_regions(pdev, BIT(0) | BIT(2) | BIT(4),
> > +				 IFCVF_DRIVER_NAME);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "Failed to request MMIO region\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> > +	if (ret) {
> > +		IFCVF_ERR(pdev, "No usable DMA configuration\n");
> > +		goto err;
> > +	}
> > +
> > +	ret = devm_add_action_or_reset(dev, ifcvf_free_irq_vectors, pdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev,
> > +			  "Failed for adding devres for freeing irq vectors\n");
> > +		goto err;
> > +	}
> > +
> > +	pci_set_master(pdev);
> > +
> > +	ret = vdpa_mgmtdev_register(&ifcvf_mgmt_dev->mdev);
> > +	if (ret) {
> > +		IFCVF_ERR(pdev,
> > +			  "Failed to initialize the management interfaces\n");
> >   		goto err;
> >   	}
> > @@ -533,14 +610,21 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >   err:
> >   	put_device(&adapter->vdpa.dev);
> > +	kfree(ifcvf_mgmt_dev);
> >   	return ret;
> >   }

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-07-05  6:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  8:21 [PATCH 0/3] vDPA/ifcvf: implement management netlink framework Zhu Lingshan
2021-06-30  8:21 ` [PATCH 1/3] vDPA/ifcvf: introduce get_dev_type() which returns virtio dev id Zhu Lingshan
2021-06-30  8:21 ` [PATCH 2/3] vDPA/ifcvf: implement management netlink framework for ifcvf Zhu Lingshan
2021-06-30 19:04   ` kernel test robot
2021-06-30 19:04     ` kernel test robot
2021-06-30 19:04     ` kernel test robot
2021-07-03  9:02     ` Michael S. Tsirkin
2021-07-03  9:02       ` Michael S. Tsirkin
2021-07-03  9:02       ` Michael S. Tsirkin
2021-07-03  9:04     ` Michael S. Tsirkin
2021-07-03  9:04       ` Michael S. Tsirkin
2021-07-03  9:04       ` Michael S. Tsirkin
2021-07-05  5:04   ` Jason Wang
2021-07-05  5:04     ` Jason Wang
2021-07-05  6:34     ` Michael S. Tsirkin [this message]
2021-07-05  6:34       ` Michael S. Tsirkin
2021-07-05  6:38       ` Zhu, Lingshan
2021-06-30  8:21 ` [PATCH 3/3] vDPA/ifcvf: set_status() should get a adapter from the mgmt dev Zhu Lingshan
2021-07-05  5:09   ` Jason Wang
2021-07-05  5:09     ` Jason Wang
2021-07-05  9:46     ` Zhu, Lingshan

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=20210705023354-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lingshan.zhu@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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 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.