> +static int vfio_pci_vf_init(struct vfio_pci_device *vdev) > +{ > + struct pci_dev *pdev = vdev->pdev; > + int ret; > + > + if (!pdev->is_physfn) > + return 0; > + > + vdev->vf_token = kzalloc(sizeof(*vdev->vf_token), GFP_KERNEL); > + if (!vdev->vf_token) > + return -ENOMEM; > +static void vfio_pci_vf_uninit(struct vfio_pci_device *vdev) > +{ > + if (!vdev->vf_token) > + return; I'd really prefer to keep these checks in the callers, as it makes the intent of the code much more clear. Same for the VGA side. But in general I like these helpers.