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.
Unified · Split
| @@ -771,7 +771,6 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, · 770 unmodified lines | ||
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | ifcvf_mgmt_dev->adapter = adapter; |
| 774 | − pci_set_drvdata(pdev, ifcvf_mgmt_dev); | |
| 775 | 774 | |
| 776 | 775 | vf = &adapter->vf; |
| 777 | 776 | 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) · 108 unmodified lines | ||
| 886 | 885 | goto err; |
| 887 | 886 | } |
| 888 | 887 | |
| 888 | + pci_set_drvdata(pdev, ifcvf_mgmt_dev); | |
| 889 | + | |
| 889 | 890 | return 0; |
| 890 | 891 | |
| 891 | 892 | err: |