Re: [PATCH] genirq/devres: Simplify API devm_free_irq() implementation

From: Zijun Hu
Date: Fri Oct 18 2024 - 07:11:12 EST


On 2024/10/18 18:58, Thomas Gleixner wrote:
> On Fri, Oct 18 2024 at 17:28, quic zijuhu wrote:
>> On 10/18/2024 4:57 PM, Thomas Gleixner wrote:
>> if irq to free was ever requested by devm_request_irq()
>> then both logic is exactly same.

[snip]

>> if (irq is not requested by devm_request_irq() {
>> warn;
>> return;
>> }
>>
>
> Ah, you are right. I thought there is a return there.
>
> So you want to explain it maybe this way:
>
> If devres_destroy() does not find a matching devres entry, then
> devm_free_irq() emits a warning and tries to free the interrupt.
>
> That's wrong as devm_free_irq() should only undo what
> devm_request_irq() set up.
>
> Replace devres_destroy() with a call to devres_release() which only
> invokes the release function (free_irq()) in case that a matching
> devres entry was found.
>

thank you. good proposal, let me update commit base on it and send v2.

> Or something like that.
>
> Thanks,
>
> tglx