* [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
@ 2025-10-10 1:17 Haotian Zhang
2025-10-10 18:47 ` Christophe JAILLET
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Haotian Zhang @ 2025-10-10 1:17 UTC (permalink / raw)
To: Support Opensource, Lee Jones; +Cc: linux-kernel, Haotian Zhang
When da9055_device_init() fails after regmap_add_irq_chip()
succeeds but mfd_add_devices() fails, the error handling path
only calls mfd_remove_devices() but forgets to call
regmap_del_irq_chip(). This results in a resource leak.
Fix this by adding regmap_del_irq_chip() to the error path so
that resources are released properly.
Fixes: 2896434cf272 ("mfd: DA9055 core driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/mfd/da9055-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index 1f727ef60d63..8c989b74f924 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -388,6 +388,7 @@ int da9055_device_init(struct da9055 *da9055)
err:
mfd_remove_devices(da9055->dev);
+ regmap_del_irq_chip(da9055->chip_irq, da9055->irq_data);
return ret;
}
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
2025-10-10 1:17 [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path Haotian Zhang
@ 2025-10-10 18:47 ` Christophe JAILLET
2025-10-25 10:33 ` Lee Jones
2025-10-15 8:33 ` Markus Elfring
2025-10-25 10:34 ` (subset) " Lee Jones
2 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2025-10-10 18:47 UTC (permalink / raw)
To: Haotian Zhang, Support Opensource, Lee Jones; +Cc: linux-kernel
Le 10/10/2025 à 03:17, Haotian Zhang a écrit :
> When da9055_device_init() fails after regmap_add_irq_chip()
> succeeds but mfd_add_devices() fails, the error handling path
> only calls mfd_remove_devices() but forgets to call
> regmap_del_irq_chip(). This results in a resource leak.
>
> Fix this by adding regmap_del_irq_chip() to the error path so
> that resources are released properly.
>
> Fixes: 2896434cf272 ("mfd: DA9055 core driver")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
> drivers/mfd/da9055-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> index 1f727ef60d63..8c989b74f924 100644
> --- a/drivers/mfd/da9055-core.c
> +++ b/drivers/mfd/da9055-core.c
> @@ -388,6 +388,7 @@ int da9055_device_init(struct da9055 *da9055)
>
> err:
> mfd_remove_devices(da9055->dev);
I don't think that mfd_remove_devices() is needed here. Looks harmless,
but should mfd_add_devices() fail, this clean-up is already done (see [1]).
CJ
[1]:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/mfd/mfd-core.c#L337
> + regmap_del_irq_chip(da9055->chip_irq, da9055->irq_data);
> return ret;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
2025-10-10 18:47 ` Christophe JAILLET
@ 2025-10-25 10:33 ` Lee Jones
0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2025-10-25 10:33 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: Haotian Zhang, Support Opensource, linux-kernel
On Fri, 10 Oct 2025, Christophe JAILLET wrote:
> Le 10/10/2025 à 03:17, Haotian Zhang a écrit :
> > When da9055_device_init() fails after regmap_add_irq_chip()
> > succeeds but mfd_add_devices() fails, the error handling path
> > only calls mfd_remove_devices() but forgets to call
> > regmap_del_irq_chip(). This results in a resource leak.
> >
> > Fix this by adding regmap_del_irq_chip() to the error path so
> > that resources are released properly.
> >
> > Fixes: 2896434cf272 ("mfd: DA9055 core driver")
> > Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> > ---
> > drivers/mfd/da9055-core.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> > index 1f727ef60d63..8c989b74f924 100644
> > --- a/drivers/mfd/da9055-core.c
> > +++ b/drivers/mfd/da9055-core.c
> > @@ -388,6 +388,7 @@ int da9055_device_init(struct da9055 *da9055)
> > err:
> > mfd_remove_devices(da9055->dev);
>
> I don't think that mfd_remove_devices() is needed here. Looks harmless, but
> should mfd_add_devices() fail, this clean-up is already done (see [1]).
>
> CJ
>
> [1]:
> https://elixir.bootlin.com/linux/v6.17.1/source/drivers/mfd/mfd-core.c#L337
Agree. I look forward to your patch.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
2025-10-10 1:17 [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path Haotian Zhang
2025-10-10 18:47 ` Christophe JAILLET
@ 2025-10-15 8:33 ` Markus Elfring
2025-10-25 10:34 ` (subset) " Lee Jones
2 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2025-10-15 8:33 UTC (permalink / raw)
To: vulab, support.opensource; +Cc: LKML, Christophe Jaillet, Lee Jones
> When da9055_device_init() fails after regmap_add_irq_chip()
> succeeds but mfd_add_devices() fails, the error handling path
…
You may occasionally put more than 61 characters into text lines
of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n658
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (subset) [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
2025-10-10 1:17 [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path Haotian Zhang
2025-10-10 18:47 ` Christophe JAILLET
2025-10-15 8:33 ` Markus Elfring
@ 2025-10-25 10:34 ` Lee Jones
2 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2025-10-25 10:34 UTC (permalink / raw)
To: Support Opensource, Lee Jones, Haotian Zhang; +Cc: linux-kernel
On Fri, 10 Oct 2025 09:17:36 +0800, Haotian Zhang wrote:
> When da9055_device_init() fails after regmap_add_irq_chip()
> succeeds but mfd_add_devices() fails, the error handling path
> only calls mfd_remove_devices() but forgets to call
> regmap_del_irq_chip(). This results in a resource leak.
>
> Fix this by adding regmap_del_irq_chip() to the error path so
> that resources are released properly.
>
> [...]
Applied, thanks!
[1/1] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
commit: be8512ed15826a24f4599ac48dd6168f9647d47d
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-25 10:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10 1:17 [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path Haotian Zhang
2025-10-10 18:47 ` Christophe JAILLET
2025-10-25 10:33 ` Lee Jones
2025-10-15 8:33 ` Markus Elfring
2025-10-25 10:34 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox