Re: [PATCH v1 1/1] regmap: irq: Get rid of duplicate check in regmap_del_irq_chip()
From: Johan Hovold
Date: Thu Oct 22 2026 - 10:18:01 EST
On Thu, Oct 22, 2026 at 02:26:51PM +0100, Mark Brown wrote:
> On Thu, Oct 22, 2026 at 10:13:57AM +0200, Johan Hovold wrote:
> > On Wed, Oct 21, 2026 at 10:50:35PM +0200, Andy Shevchenko wrote:
> > > irq_dispose_mapping() already 0-aware, so there is no need to
> > > perform the same test outside of the call. Get rid of duplicate
> > > check in regmap_del_irq_chip().
>
> > > - virq = irq_find_mapping(d->domain, hwirq);
> > > - if (virq)
> > > - irq_dispose_mapping(virq);
> > > + irq_dispose_mapping(irq_find_mapping(d->domain, hwirq));
>
> > This just makes the code less readable, and for no good reason.
>
> Is there intended to be a benefit from the error check? It seems like a
> microopotimisation that just removes robustness from something that
> really should not be a hot path.
The code as it stands is easier to read and obviously correct (and
matches the preceding comment); you don't need look up the definition of
irq_dispose_mapping() and parse a ternary conditional to determine that.
Johan
Attachment:
signature.asc
Description: PGP signature