[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875z7kwila.fsf@nanos.tec.linutronix.de>
Date: Thu, 08 Oct 2020 22:47:29 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Marc Zyngier <maz@...nel.org>
Cc: linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Dmitry Osipenko <digetx@...il.com>,
Sowjanya Komatineni <skomatineni@...dia.com>,
Venkat Reddy Talla <vreddytalla@...dia.com>,
kernel-team@...roid.com
Subject: Re: [PATCH v3 1/4] genirq/irqdomain: Allow partial trimming of irq_data hierarchy
On Thu, Oct 08 2020 at 14:06, Marc Zyngier wrote:
> On 2020-10-08 12:22, Thomas Gleixner wrote:
> Here's what I have now, with the pmc driver calling
> irq_domain_disconnect_hierarchy() at the right spots.
>
> static int irq_domain_alloc_irq_data(struct irq_domain *domain,
> @@ -1362,11 +1442,16 @@ int __irq_domain_alloc_irqs(struct irq_domain
> *domain, int irq_base,
> mutex_unlock(&irq_domain_mutex);
> goto out_free_irq_data;
> }
> - for (i = 0; i < nr_irqs; i++)
> + for (i = 0; i < nr_irqs; i++) {
> + ret = irq_domain_trim_hierarchy(virq + i);
> + if (ret)
> + break;
> irq_domain_insert_irq(virq + i);
You can't do that in one go because in case of an error you leak the
already inserted irqs. You need two loops.
for (i = 0; i < nr_irqs; i++) {
ret = irq_domain_trim_hierarchy(virq + i);
if (ret) {
mutex_unlock(&irq_domain_mutex);
goto out_free_irq_data;
}
for (i = 0; i < nr_irqs; i++)
irq_domain_insert_irq(virq + i);
mutex_unlock(&irq_domain_mutex);
return virq;
> out_free_irq_data:
> irq_domain_free_irq_data(virq, nr_irqs);
Thanks,
tglx
Powered by blists - more mailing lists