Skip to contentSkip to conversation

irqchip/mbigen: Free msi_desc on device teardown

PATCH Applied Zenghui Yu 3 participants 4 messages Apr 8, 2020 – Apr 17, 2020 irqchip drivers

lore
Share & tools
lore

Zenghui Yu

author
#0 lore raw

PATCH 1/1 irqchip/mbigen: Free msi_desc on device teardown

Using irq_domain_free_irqs_common() on the irqdomain free path will leave the MSI descriptor unfreed when platform devices get removed. Properly free it by MSI domain free function.

---
 drivers/irqchip/irq-mbigen.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mbigen.c +7 -1
index 6b566bba263b..ff7627b57772 100644
@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
 	return 0;
 }
 
+static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
+				   unsigned int nr_irqs)
+{
+	platform_msi_domain_free(domain, virq, nr_irqs);
+}
+
 static const struct irq_domain_ops mbigen_domain_ops = {
 	.translate	= mbigen_domain_translate,
 	.alloc		= mbigen_irq_domain_alloc,
-	.free		= irq_domain_free_irqs_common,
+	.free		= mbigen_irq_domain_free,
 };
 
 static int mbigen_of_create_domain(struct platform_device *pdev,
Signature · 1 line
2.19.1
#1 lore raw

On Wed, 8 Apr 2020 19:43:52 +0800
Zenghui Yu <[email protected]> wrote:

Hi Zenghui,

Quoted 21 lines

Using irq_domain_free_irqs_common() on the irqdomain free path will leave the MSI descriptor unfreed when platform devices get removed. Properly free it by MSI domain free function.

---
 drivers/irqchip/irq-mbigen.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mbigen.c +4 -0
index 6b566bba263b..ff7627b57772 100644
@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
 	return 0;
 }
 
+static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
+				   unsigned int nr_irqs)
+{
+	platform_msi_domain_free(domain, virq, nr_irqs);

drivers/irqchip/irq-mbigen.c static int mbigen_irq_domain_alloc(struct irq_domain *domain, · line 235

Quoted 10 lines
drivers/irqchip/irq-mbigen.c +3 -1
+}
+
 static const struct irq_domain_ops mbigen_domain_ops = {
 	.translate	= mbigen_domain_translate,
 	.alloc		= mbigen_irq_domain_alloc,
-	.free		= irq_domain_free_irqs_common,
+	.free		= mbigen_irq_domain_free,
 };
 
 static int mbigen_of_create_domain(struct platform_device *pdev,

Should this deserve a:

Fixes 9650c60ebfec0 ("irqchip/mbigen: Create irq domain for each

mbigen device")

Otherwise queued for post -rc1.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author
#2 lore raw

Hi Marc,

Quoted 35 lines · Marc Zyngier

On Wed, 8 Apr 2020 19:43:52 +0800
Zenghui Yu <[email protected]> wrote:

Hi Zenghui,

Quoted 30 lines

Using irq_domain_free_irqs_common() on the irqdomain free path will leave the MSI descriptor unfreed when platform devices get removed. Properly free it by MSI domain free function.

---
  drivers/irqchip/irq-mbigen.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mbigen.c +7 -1
index 6b566bba263b..ff7627b57772 100644
@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
  	return 0;
  }
 
+static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
+				   unsigned int nr_irqs)
+{
+	platform_msi_domain_free(domain, virq, nr_irqs);
+}
+
  static const struct irq_domain_ops mbigen_domain_ops = {
  	.translate	= mbigen_domain_translate,
  	.alloc		= mbigen_irq_domain_alloc,
-	.free		= irq_domain_free_irqs_common,
+	.free		= mbigen_irq_domain_free,
  };
 
Quoted 6 lines

drivers/irqchip/irq-mbigen.c static int mbigen_irq_domain_alloc(struct irq_domain *domain, · line 235

Quoted 1 line
drivers/irqchip/irq-mbigen.c +0 -0
  static int mbigen_of_create_domain(struct platform_device *pdev,

Should this deserve a:

Fixes 9650c60ebfec0 ("irqchip/mbigen: Create irq domain for each

mbigen device")

Yes, please help to add it.

Quoted 2 lines

Otherwise queued for post -rc1.

Thanks!

Zenghui

merge bot Applied
#3 lore raw
In reply to Zenghui Yu
The following commit has been merged into the irq/urgent branch of tip:

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     edfc23f6f9fdbd7825d50ac1f380243cde19b679
Gitweb:        https://git.kernel.org/tip/edfc23f6f9fdbd7825d50ac1f380243cde19b679
Author:        Zenghui Yu <[email protected]>
AuthorDate:    Wed, 08 Apr 2020 19:43:52 +08:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Fri, 17 Apr 2020 08:59:27 +01:00

irqchip/mbigen: Free msi_desc on device teardown

Using irq_domain_free_irqs_common() on the irqdomain free path will leave the MSI descriptor unfreed when platform devices get removed. Properly free it by MSI domain free function.

Fixes 9650c60ebfec0 ("irqchip/mbigen: Create irq domain for each mbigen device")
---
 drivers/irqchip/irq-mbigen.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mbigen.c +7 -1
index 6b566bb..ff7627b 100644
@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
 	return 0;
 }
 
+static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
+				   unsigned int nr_irqs)
+{
+	platform_msi_domain_free(domain, virq, nr_irqs);
+}
+
 static const struct irq_domain_ops mbigen_domain_ops = {
 	.translate	= mbigen_domain_translate,
 	.alloc		= mbigen_irq_domain_alloc,
-	.free		= irq_domain_free_irqs_common,
+	.free		= mbigen_irq_domain_free,
 };
 
 static int mbigen_of_create_domain(struct platform_device *pdev,