[PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable()

From: Jim Harris
Date: Wed Dec 13 2023 - 13:58:39 EST


Wait to call kobject_uevent() until all of the associated changes are done,
including updating the num_VFs value.

Suggested by: Leon Romanovsky <leonro@xxxxxxxxxx>
Signed-off-by: Jim Harris <jim.harris@xxxxxxxxxxx>
---
drivers/pci/iov.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 25dbe85c4217..3b768e20c7ab 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -683,8 +683,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
if (rc)
goto err_pcibios;

- kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
iov->num_VFs = nr_virtfn;
+ kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);

return 0;