Re: [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails
From: Daniel Byrne
Date: Fri Dec 04 2026 - 15:50:17 EST
On Thu, 3 Dec 2026 17:44:01 +0000, Frank Li wrote:
> > + idxd_wq_free_irq(wq);
> > idxd_wq_free_resources(wq);
> > + goto err_irq;
>
> why need go to here. avoid goto again at error path.
Hi Frank,
Thanks for the review.
The goto was there because the interrupt has to be freed before the
resources on this path. idxd_wq_free_resources() clears the queue's
type, and idxd_wq_free_irq() returns right away for a queue that is not
a kernel queue. So I could not just let it fall through to the label
below, which frees the interrupt after the resources.
I will fix this in v3. I think a better way is to allocate the resources
before the interrupt is requested. Then the unwind frees the interrupt
first and falls straight through to err_irq label (and below):
err_ref:
idxd_wq_free_irq(wq);
err_irq:
idxd_wq_free_resources(wq);
err_res_alloc:
idxd_wq_unmap_portal(wq);
idxd_drv_disable_wq() also frees the interrupt before the resources. I
tested it and it leaves no interrupt or allocation behind.
Thanks,
Daniel