]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:13:31 +0000 (11:13 +0100)
commit8e28a01b69f7ea8df7ceb15470cfe643b2828f4f
tree68a7826c8b2cdb0cfe52fdb382f5c972d144987e
parent8c809b6199f9e452615b5df82d7ce8ddaf63c6da
spi: amlogic-spisg: Fix memory leak in aml_spisg_probe()

[ Upstream commit b8db9552997924b750e727a625a30eaa4603bbb9 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-amlogic-spisg.c