Re: [PATCH net v3 2/2] net: fec: free the PPS interrupt before tearing down the PHC and netdev

From: Shengzhuo Wei

Date: Wed Sep 09 2026 - 15:55:08 EST


> > +
> > + if (fep->pps_irq >= 0) {
> > + free_irq(fep->pps_irq, ndev);
> > + fep->pps_irq = -1;
> > + }
> > +
>
> I think fep->pps_irq > 0 would be more appropriate here,
> since the IRQ returned by platform_get_irq_byname_optional() or
> platform_get_irq_optional() cannot be 0.

Hi Phuc,

You're right. I hadn't checked whether these helpers could return
IRQ 0.

I saw the existing irq >= 0 check in the request path and wanted
the release path to match it. I used -1 to distinguish "no IRQ
requested" from a possible IRQ 0, recording the IRQ only after
request_irq() succeeded.

Since both helpers reject IRQ 0, that extra handling is unnecessary.
Keeping pps_irq at its initial value of 0 and checking > 0 before
free_irq() is sufficient.

Wei, I plan to drop the -1 initialization, use > 0 for the release
check, and reset pps_irq to 0 after freeing it. Do you have any
concerns with that change?

Thanks for pointing this out.

Best regards,
Shengzhuo