diff mbox series

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

Message ID 20250114034405.4416-1-haiyuewa@163.com (mailing list archive)
State New
Headers show
Series [v1] vfio/pci: Change the variable 'physfn' definition scope | expand

Commit Message

Haiyue Wang Jan. 14, 2025, 3:43 a.m. UTC
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 mbox series

Patch

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) {