mfd: da9055: Fix missing regmap_del_irq_chip() in error path
Subsystems (2)
PATCH 1/1 mfd: da9055: Fix missing regmap_del_irq_chip() in error path
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.
--- drivers/mfd/da9055-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/da9055-core.c +1 -0
@@ -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; }
Signature · 1 line
2.50.1.windows.1
Le 10/10/2025 à 03:17, Haotian Zhang a écrit :
Quoted 19 lines
When
da9055_device_init()fails afterregmap_add_irq_chip()succeeds butmfd_add_devices()fails, the error handling path only callsmfd_remove_devices()but forgets to callregmap_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 <[email protected]>--- drivers/mfd/da9055-core.c | 1 + 1 file changed, 1 insertion(+)drivers/mfd/da9055-core.c +0
-0
drivers/mfd/da9055-core.c int da9055_device_init(struct da9055 *da9055) · line 390
Quoted 3 lines
drivers/mfd/da9055-core.c +0
-0@@ -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
Quoted 4 lines
drivers/mfd/da9055-core.c +1
-0+regmap_del_irq_chip (da9055->chip_irq, da9055->irq_data);return ret; }
Lee Jones
maintainerQuoted 26 lines · Christophe JAILLET
Le 10/10/2025 à 03:17, Haotian Zhang a écrit :
Quoted 19 lines
When
da9055_device_init()fails afterregmap_add_irq_chip()succeeds butmfd_add_devices()fails, the error handling path only callsmfd_remove_devices()but forgets to callregmap_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 <[email protected]>--- drivers/mfd/da9055-core.c | 1 + 1 file changed, 1 insertion(+)drivers/mfd/da9055-core.c +0
-0drivers/mfd/da9055-core.c int da9055_device_init(struct da9055 *da9055) · line 389
Quoted 2 lines
drivers/mfd/da9055-core.c +0
-0@@ -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 shouldmfd_add_devices()fail, this clean-up is already done (see [1]).
Quoted 4 lines
CJ
[1]:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/mfd/mfd-core.c#L337
Agree. I look forward to your patch.
Signature · 1 line
Lee Jones [李琼斯]
Quoted 2 lines
When
da9055_device_init()fails afterregmap_add_irq_chip()succeeds butmfd_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
Re: (subset) [PATCH] mfd: da9055: Fix missing regmap_del_irq_chip() in error path
In reply to Haotian ZhangQuoted 9 lines · Haotian Zhang
When
da9055_device_init()fails afterregmap_add_irq_chip()succeeds butmfd_add_devices()fails, the error handling path only callsmfd_remove_devices()but forgets to callregmap_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 [李琼斯]