Re: [PATCH v6 7/8] gpiolib: let the character device free its IRQs first on chip removal

From: Adrian Ambrozewicz

Date: Thu Nov 19 2026 - 02:06:21 EST


On Wed, Nov 18, 2026 at 11:52:07PM +0800, Kent Gibson wrote:
> > + scoped_guard(mutex, &lr->config_mutex) {
> > + for (i = 0; i < lr->num_lines; i++) {
> > + if (lr->lines[i].desc)
> > + edge_detector_stop(&lr->lines[i]);
> > + }
> > + }
> > +
>
> The desc check is not strictly necessary - edge_detector_stop() handles a NULL
> desc. The check just prevents a little pointless re-initialisation for
> failed requests so I'd be fine with removing the check.
>
> > for (i = 0; i < lr->num_lines; i++) {
> > - if (lr->lines[i].desc) {
> > - edge_detector_stop(&lr->lines[i]);
> > + if (lr->lines[i].desc)
> > gpiod_free(lr->lines[i].desc);
> > - }
>
> gpiod_free() has its own NULL check so the desc check here is redundant.
> While it was bundled with edge_detector_stop() it was a free lunch...

Thanks for the review. Agreed on both; I plan to drop the two checks in
v7.

Adrian