]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
vdpa: ifcvf: set pci driver data in probe
authorJason Wang <jasowang@redhat.com>
Tue, 24 May 2022 05:55:57 +0000 (13:55 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 1 Jun 2022 06:16:38 +0000 (02:16 -0400)
We should set the pci driver data in probe instead of the vdpa device
adding callback. Otherwise if no vDPA device is created we will lose
the pointer to the management device.

Fixes: 6b5df347c6482 ("vDPA/ifcvf: implement management netlink framework for ifcvf")
Tested-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220524055557.1938-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/ifcvf/ifcvf_main.c

index 750e5f23406d8745575af168545369667747228d..0a5670729412cbbc5d6f68dc24a1d5466545541c 100644 (file)
@@ -771,7 +771,6 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
        }
 
        ifcvf_mgmt_dev->adapter = adapter;
-       pci_set_drvdata(pdev, ifcvf_mgmt_dev);
 
        vf = &adapter->vf;
        vf->dev_type = get_dev_type(pdev);
@@ -886,6 +885,8 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto err;
        }
 
+       pci_set_drvdata(pdev, ifcvf_mgmt_dev);
+
        return 0;
 
 err: