[PATCH v1] vfio/pci: Change the variable 'physfn' definition scope

Haiyue Wang posted 1 patch 11 months ago
drivers/vfio/pci/vfio_pci_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH v1] vfio/pci: Change the variable 'physfn' definition scope
Posted by Haiyue Wang 11 months ago
Move the variable 'physfn' definition into PF finding code block, since
it is initialized and used there.

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
---
 drivers/vfio/pci/vfio_pci_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 1a4ed5a357d3..6cbbb446531b 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -2006,7 +2006,6 @@ static int vfio_pci_vf_init(struct vfio_pci_core_device *vdev)
 {
 	struct pci_dev *pdev = vdev->pdev;
 	struct vfio_pci_core_device *cur;
-	struct pci_dev *physfn;
 	int ret;
 
 	if (pdev->is_virtfn) {
@@ -2016,7 +2015,7 @@ static int vfio_pci_vf_init(struct vfio_pci_core_device *vdev)
 		 * the locking in pci_disable_sriov() it cannot change until
 		 * this VF device driver is removed.
 		 */
-		physfn = pci_physfn(vdev->pdev);
+		struct pci_dev *physfn = pci_physfn(vdev->pdev);
 		mutex_lock(&vfio_pci_sriov_pfs_mutex);
 		list_for_each_entry(cur, &vfio_pci_sriov_pfs, sriov_pfs_item) {
 			if (cur->pdev == physfn) {
-- 
2.48.0