[PATCH] soc: microchip: mpfs: Fix a memory leak in mpfs_sys_controller_probe()

Markus Elfring Markus.Elfring at web.de
Tue Feb 3 08:00:44 PST 2026


> In mpfs_sys_controller_probe(), when of_get_mtd_device_by_node() fails,
> the previously allocated sys_controller was leaked.
> 
> Add kfree() to fix this.

https://elixir.bootlin.com/linux/v6.19-rc5/source/drivers/soc/microchip/mpfs-sys-controller.c#L128-L177

* Were any source code analysis tools involved here?

* Would you like to complete the exception handling by using another goto chain?

* How do you think about to increase the application of scope-based resource management?

* See also once more:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v6.19-rc8#n34


Regards,
Markus



More information about the linux-riscv mailing list