]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: amlogic-spisg: Fix memory leak in aml_spisg_probe()
authorFelix Gu <ustc.gu@gmail.com>
Sun, 8 Mar 2026 06:49:21 +0000 (14:49 +0800)
committerMark Brown <broonie@kernel.org>
Sun, 15 Mar 2026 23:58:47 +0000 (23:58 +0000)
commitb8db9552997924b750e727a625a30eaa4603bbb9
tree3996aaf308f6d75612e96b188bb2fbbe538a23b4
parenta00da54d06f435dbbeacb84f9121dbbe6d6eda74
spi: amlogic-spisg: Fix memory leak in aml_spisg_probe()

In aml_spisg_probe(), ctlr is allocated by
spi_alloc_target()/spi_alloc_host(), but fails to call
spi_controller_put() in several error paths. This leads
to a memory leak whenever the driver fails to probe after
the initial allocation.

Convert to use devm_spi_alloc_host()/devm_spi_alloc_target()
to fix the memory leak.

Fixes: cef9991e04ae ("spi: Add Amlogic SPISG driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260308-spisg-v1-1-2cace5cafc24@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-amlogic-spisg.c