On Thursday, August 17, 2023 12:20 AM, Brett Creeley <bcreeley@xxxxxxx> wrote: > > +{ > > + struct device *dev = &pdev->dev; > > + struct qat_vf_core_device *qat_vdev; > > + int ret; > > + > > + qat_vdev = vfio_alloc_device(qat_vf_core_device, core_device.vdev, > dev, &qat_vf_pci_ops); > > + if (IS_ERR(qat_vdev)) > > + return PTR_ERR(qat_vdev); > > + > > + qat_vdev->vf_id = pci_iov_vf_id(pdev); > > + qat_vdev->parent = pdev->physfn; > > + if (!qat_vdev->parent || qat_vdev->vf_id < 0) > > + return -EINVAL; > > Since vfio_alloc_device() was successful you need to call > vfio_put_device() in this error case as well. Good catch, will fix it. Thanks for the comment, Brett. > > + > > + pci_set_drvdata(pdev, &qat_vdev->core_device); > > + ret = vfio_pci_core_register_device(&qat_vdev->core_device); > > + if (ret) > > + goto out_put_device; > > + > > + return 0; > > + > > +out_put_device: > > + vfio_put_device(&qat_vdev->core_device.vdev); > > + return ret; > > +} > > + > > +static struct qat_vf_core_device *qat_vf_drvdata(struct pci_dev *pdev) > > +{ > > + struct vfio_pci_core_device *core_device = pci_get_drvdata(pdev); > > + > > + return container_of(core_device, struct qat_vf_core_device, > core_device); > > +} > > + > > + > > +MODULE_LICENSE("GPL"); > > +MODULE_AUTHOR("Intel Corporation"); > > +MODULE_DESCRIPTION("QAT VFIO PCI - VFIO PCI driver with live > migration support for Intel(R) QAT device family"); > > -- > > 2.18.2 > >