[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319105506.444764312@linutronix.de>
Date: Wed, 19 Mar 2025 11:56:50 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Marc Zyngier <maz@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Nishanth Menon <nm@...com>,
Dhruva Gole <d-gole@...com>,
Tero Kristo <kristo@...nel.org>,
Santosh Shilimkar <ssantosh@...nel.org>,
Logan Gunthorpe <logang@...tatee.com>,
Dave Jiang <dave.jiang@...el.com>,
Jon Mason <jdmason@...zu.us>,
Allen Hubbe <allenbh@...il.com>,
ntb@...ts.linux.dev,
Michael Kelley <mhklinux@...look.com>,
Wei Liu <wei.liu@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
linux-hyperv@...r.kernel.org,
linux-pci@...r.kernel.org,
Wei Huang <wei.huang2@....com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...ei.com>
Subject: [patch V4 07/14] PCI/MSI: Use __free() for affinity masks
Let cleanup handle the freeing of the affinity mask. That prepares for
switching the MSI descriptor locking to a guard().
No functional change.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
V4: Split out of the previous combo patch
---
drivers/pci/msi/msi.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -351,7 +351,6 @@ static int msi_verify_entries(struct pci
static int msi_capability_init(struct pci_dev *dev, int nvec,
struct irq_affinity *affd)
{
- struct irq_affinity_desc *masks = NULL;
struct msi_desc *entry, desc;
int ret;
@@ -362,8 +361,8 @@ static int msi_capability_init(struct pc
/* Disable MSI during setup in the hardware to erase stale state */
pci_msi_set_enable(dev, 0);
- if (affd)
- masks = irq_create_affinity_masks(nvec, affd);
+ struct irq_affinity_desc *masks __free(kfree) =
+ affd ? irq_create_affinity_masks(nvec, affd) : NULL;
msi_lock_descs(&dev->dev);
ret = msi_setup_msi_desc(dev, nvec, masks);
@@ -403,7 +402,6 @@ static int msi_capability_init(struct pc
pci_free_msi_irqs(dev);
unlock:
msi_unlock_descs(&dev->dev);
- kfree(masks);
return ret;
}
@@ -664,12 +662,10 @@ static void msix_mask_all(void __iomem *
static int msix_setup_interrupts(struct pci_dev *dev, struct msix_entry *entries,
int nvec, struct irq_affinity *affd)
{
- struct irq_affinity_desc *masks = NULL;
+ struct irq_affinity_desc *masks __free(kfree) =
+ affd ? irq_create_affinity_masks(nvec, affd) : NULL;
int ret;
- if (affd)
- masks = irq_create_affinity_masks(nvec, affd);
-
msi_lock_descs(&dev->dev);
ret = msix_setup_msi_descs(dev, entries, nvec, masks);
if (ret)
@@ -691,7 +687,6 @@ static int msix_setup_interrupts(struct
pci_free_msi_irqs(dev);
out_unlock:
msi_unlock_descs(&dev->dev);
- kfree(masks);
return ret;
}
Powered by blists - more mailing lists