Skip to content

Commit

Permalink
vdpa: ifcvf: set pci driver data in probe
Browse files Browse the repository at this point in the history
[ Upstream commit bd8bb9a ]

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: 6b5df34 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jasowang authored and gregkh committed Jun 14, 2022
1 parent 88cd232 commit 9983f49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/vdpa/ifcvf/ifcvf_main.c
Expand Up @@ -505,7 +505,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);
Expand Down Expand Up @@ -620,6 +619,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:
Expand Down

0 comments on commit 9983f49

Please sign in to comment.