All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: quic_zijuhu <quic_zijuhu@quicinc.com>, Zijun Hu <zijun_hu@icloud.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] genirq/devres: Simplify API devm_free_irq() implementation
Date: Fri, 18 Oct 2024 12:58:42 +0200	[thread overview]
Message-ID: <87plnx8yot.ffs@tglx> (raw)
In-Reply-To: <fa7268e4-24a9-4ddb-8477-e4959a6105ad@quicinc.com>

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.
>
> otherwise, actually change devres_free_irq()'s logic from
>
> if (irq is not requested by devm_request_irq() {
> 	warn;
> }
> free_irq()
>
> To
>
> 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.

Or something like that.

Thanks,

        tglx

  reply	other threads:[~2024-10-18 10:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 15:16 [PATCH] genirq/devres: Simplify API devm_free_irq() implementation Zijun Hu
2024-10-17 20:33 ` Thomas Gleixner
2024-10-17 22:36   ` Zijun Hu
2024-10-18  8:57     ` Thomas Gleixner
2024-10-18  9:28       ` quic_zijuhu
2024-10-18 10:58         ` Thomas Gleixner [this message]
2024-10-18 11:08           ` Zijun Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plnx8yot.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_zijuhu@quicinc.com \
    --cc=zijun_hu@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.