Skip to content

Commit b0c44a5

Browse files
committed
PCI/MSI: Set pci_dev:: Msi_enabled late
The comment claiming that pci_dev::msi_enabled has to be set across setup is a leftover from ancient code versions. Nothing in the setup code requires the flag to be set anymore. Set it in the success path and remove the extra goto label. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 497f68c commit b0c44a5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/pci/msi/msi.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,20 +358,16 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
358358
if (nvec > 1 && !pci_msi_domain_supports(dev, MSI_FLAG_MULTI_PCI_MSI, ALLOW_LEGACY))
359359
return 1;
360360

361-
/*
362-
* Disable MSI during setup in the hardware, but mark it enabled
363-
* so that setup code can evaluate it.
364-
*/
361+
/* Disable MSI during setup in the hardware to erase stale state */
365362
pci_msi_set_enable(dev, 0);
366-
dev->msi_enabled = 1;
367363

368364
if (affd)
369365
masks = irq_create_affinity_masks(nvec, affd);
370366

371367
msi_lock_descs(&dev->dev);
372368
ret = msi_setup_msi_desc(dev, nvec, masks);
373369
if (ret)
374-
goto fail;
370+
goto unlock;
375371

376372
/* All MSIs are unmasked by default; mask them all */
377373
entry = msi_first_desc(&dev->dev, MSI_DESC_ALL);
@@ -393,6 +389,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
393389
goto err;
394390

395391
/* Set MSI enabled bits */
392+
dev->msi_enabled = 1;
396393
pci_intx_for_msi(dev, 0);
397394
pci_msi_set_enable(dev, 1);
398395

@@ -403,8 +400,6 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
403400
err:
404401
pci_msi_unmask(&desc, msi_multi_mask(&desc));
405402
pci_free_msi_irqs(dev);
406-
fail:
407-
dev->msi_enabled = 0;
408403
unlock:
409404
msi_unlock_descs(&dev->dev);
410405
kfree(masks);

0 commit comments

Comments
 (0)