* [PATCH] sh: maple: use the matching IRQ cookie
@ 2026-10-09 4:02 Runyu Xiao
2026-10-16 14:04 ` John Paul Adrian Glaubitz
2026-10-17 18:22 ` Florian Fuchs
0 siblings, 2 replies; 4+ messages in thread
From: Runyu Xiao @ 2026-10-09 4:02 UTC (permalink / raw)
To: Yoshinori Sato
Cc: Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel,
stable, Runyu Xiao, Jianhao Xu
The Maple DMA and VBLANK handlers are registered with
&maple_unsupported_device as their dev_id. Passing NULL to free_irq()
cannot find either action, so the handlers remain registered and the
IRQ core warns.
Use the same cookie when freeing both handlers on the error paths.
Fixes: 17be2d2b1c33 ("sh: Add maple bus support for the SEGA Dreamcast.")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
drivers/sh/maple/maple.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 5585f220e..7df88e00c 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -863,10 +863,10 @@ static int __init maple_bus_init(void)
kmem_cache_destroy(maple_queue_cache);
cleanup_bothirqs:
- free_irq(HW_EVENT_VSYNC, 0);
+ free_irq(HW_EVENT_VSYNC, &maple_unsupported_device);
cleanup_irq:
- free_irq(HW_EVENT_MAPLE_DMA, 0);
+ free_irq(HW_EVENT_MAPLE_DMA, &maple_unsupported_device);
cleanup_dma:
free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sh: maple: use the matching IRQ cookie
2026-10-09 4:02 [PATCH] sh: maple: use the matching IRQ cookie Runyu Xiao
@ 2026-10-16 14:04 ` John Paul Adrian Glaubitz
2026-10-17 18:22 ` Florian Fuchs
1 sibling, 0 replies; 4+ messages in thread
From: John Paul Adrian Glaubitz @ 2026-10-16 14:04 UTC (permalink / raw)
To: Runyu Xiao, Yoshinori Sato, Geert Uytterhoeven, Florian Fuchs
Cc: Rich Felker, linux-sh, linux-kernel, stable, Jianhao Xu
Hi Runyu,
On Fri, 2026-10-09 at 12:02 +0800, Runyu Xiao wrote:
> The Maple DMA and VBLANK handlers are registered with
> &maple_unsupported_device as their dev_id. Passing NULL to free_irq()
> cannot find either action, so the handlers remain registered and the
> IRQ core warns.
>
> Use the same cookie when freeing both handlers on the error paths.
>
> Fixes: 17be2d2b1c33 ("sh: Add maple bus support for the SEGA Dreamcast.")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
> drivers/sh/maple/maple.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
> index 5585f220e..7df88e00c 100644
> --- a/drivers/sh/maple/maple.c
> +++ b/drivers/sh/maple/maple.c
> @@ -863,10 +863,10 @@ static int __init maple_bus_init(void)
> kmem_cache_destroy(maple_queue_cache);
>
> cleanup_bothirqs:
> - free_irq(HW_EVENT_VSYNC, 0);
> + free_irq(HW_EVENT_VSYNC, &maple_unsupported_device);
>
> cleanup_irq:
> - free_irq(HW_EVENT_MAPLE_DMA, 0);
> + free_irq(HW_EVENT_MAPLE_DMA, &maple_unsupported_device);
>
> cleanup_dma:
> free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
I'm not 100% versed in the IRQ code but looking how both HW_EVENT_VSYNC
and HW_EVENT_MAPLE_DMA are registered using the maple_unsupported_device
cookie but not unregistered using them, your change seems logical.
Maybe Geert or Florian can have a second look and add their Reviewed-by.
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sh: maple: use the matching IRQ cookie
2026-10-09 4:02 [PATCH] sh: maple: use the matching IRQ cookie Runyu Xiao
2026-10-16 14:04 ` John Paul Adrian Glaubitz
@ 2026-10-17 18:22 ` Florian Fuchs
2026-10-17 18:34 ` John Paul Adrian Glaubitz
1 sibling, 1 reply; 4+ messages in thread
From: Florian Fuchs @ 2026-10-17 18:22 UTC (permalink / raw)
To: Runyu Xiao
Cc: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, linux-sh,
linux-kernel, stable, Jianhao Xu
On 09 Oct 12:02, Runyu Xiao wrote:
> The Maple DMA and VBLANK handlers are registered with
> &maple_unsupported_device as their dev_id. Passing NULL to free_irq()
> cannot find either action, so the handlers remain registered and the
> IRQ core warns.
>
> Use the same cookie when freeing both handlers on the error paths.
>
> Fixes: 17be2d2b1c33 ("sh: Add maple bus support for the SEGA Dreamcast.")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
> drivers/sh/maple/maple.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
> index 5585f220e..7df88e00c 100644
> --- a/drivers/sh/maple/maple.c
> +++ b/drivers/sh/maple/maple.c
> @@ -863,10 +863,10 @@ static int __init maple_bus_init(void)
> kmem_cache_destroy(maple_queue_cache);
>
> cleanup_bothirqs:
> - free_irq(HW_EVENT_VSYNC, 0);
> + free_irq(HW_EVENT_VSYNC, &maple_unsupported_device);
>
> cleanup_irq:
> - free_irq(HW_EVENT_MAPLE_DMA, 0);
> + free_irq(HW_EVENT_MAPLE_DMA, &maple_unsupported_device);
>
> cleanup_dma:
> free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
> --
> 2.34.1
The patch looks correct to me and works like intended, that it frees the
corresponding IRQ handler in the error path.
Reviewed-By: Florian Fuchs <fuchsfl@gmail.com>
Tested-by: Florian Fuchs <fuchsfl@gmail.com>
Fixes: b3c69e248176 ("maple: more robust device detection.")
Just a little addition, it looks like commit b3c69e248176
("maple: more robust device detection.") introduced the issue, where the
static irqaction with IRQF_SHARED, was replaced by a request_irq() with
a cookie, but the free_irq() wasn't updated.
I tested the patch with a forced failure of maple_bus_init(), which
gives the WARNs and keeps the handlers registered in /proc/interrupts:
Trying to free already-free IRQ 69
WARNING: kernel/irq/manage.c:1880 at 0x8c0522c4, CPU#0: swapper/0/1
After the patch, the IRQ handlers are unregistered in /proc/interrupts
and no kernel WARN is shown.
And tested if keyboard, mouse still work with the patch, which they do.
Thank you!
Regards
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sh: maple: use the matching IRQ cookie
2026-10-17 18:22 ` Florian Fuchs
@ 2026-10-17 18:34 ` John Paul Adrian Glaubitz
0 siblings, 0 replies; 4+ messages in thread
From: John Paul Adrian Glaubitz @ 2026-10-17 18:34 UTC (permalink / raw)
To: Florian Fuchs, Runyu Xiao
Cc: Yoshinori Sato, Rich Felker, linux-sh, linux-kernel, stable, Jianhao Xu
Hi Florian,
On Sat, 2026-10-17 at 20:22 +0200, Florian Fuchs wrote:
> On 09 Oct 12:02, Runyu Xiao wrote:
> > The Maple DMA and VBLANK handlers are registered with
> > &maple_unsupported_device as their dev_id. Passing NULL to free_irq()
> > cannot find either action, so the handlers remain registered and the
> > IRQ core warns.
> >
> > Use the same cookie when freeing both handlers on the error paths.
> >
> > Fixes: 17be2d2b1c33 ("sh: Add maple bus support for the SEGA Dreamcast.")
> > Cc: stable@vger.kernel.org
> > Assisted-by: LLM
> > Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> > ---
> > drivers/sh/maple/maple.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
> > index 5585f220e..7df88e00c 100644
> > --- a/drivers/sh/maple/maple.c
> > +++ b/drivers/sh/maple/maple.c
> > @@ -863,10 +863,10 @@ static int __init maple_bus_init(void)
> > kmem_cache_destroy(maple_queue_cache);
> >
> > cleanup_bothirqs:
> > - free_irq(HW_EVENT_VSYNC, 0);
> > + free_irq(HW_EVENT_VSYNC, &maple_unsupported_device);
> >
> > cleanup_irq:
> > - free_irq(HW_EVENT_MAPLE_DMA, 0);
> > + free_irq(HW_EVENT_MAPLE_DMA, &maple_unsupported_device);
> >
> > cleanup_dma:
> > free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
> > --
> > 2.34.1
>
> The patch looks correct to me and works like intended, that it frees the
> corresponding IRQ handler in the error path.
>
> Reviewed-By: Florian Fuchs <fuchsfl@gmail.com>
> Tested-by: Florian Fuchs <fuchsfl@gmail.com>
> Fixes: b3c69e248176 ("maple: more robust device detection.")
>
> Just a little addition, it looks like commit b3c69e248176
> ("maple: more robust device detection.") introduced the issue, where the
> static irqaction with IRQF_SHARED, was replaced by a request_irq() with
> a cookie, but the free_irq() wasn't updated.
>
> I tested the patch with a forced failure of maple_bus_init(), which
> gives the WARNs and keeps the handlers registered in /proc/interrupts:
> Trying to free already-free IRQ 69
> WARNING: kernel/irq/manage.c:1880 at 0x8c0522c4, CPU#0: swapper/0/1
>
> After the patch, the IRQ handlers are unregistered in /proc/interrupts
> and no kernel WARN is shown.
>
> And tested if keyboard, mouse still work with the patch, which they do.
Thanks a lot for both the additional review and testing!
Since I'm using b4, it will automatically pick up the Fixes tag you provided.
Will apply the patch tomorrow or Monday.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-17 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 4:02 [PATCH] sh: maple: use the matching IRQ cookie Runyu Xiao
2026-10-16 14:04 ` John Paul Adrian Glaubitz
2026-10-17 18:22 ` Florian Fuchs
2026-10-17 18:34 ` John Paul Adrian Glaubitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®