Commit cc486389 authored by Lukas Wunner's avatar Lukas Wunner Committed by Xie XiuQi
Browse files

spi: mxic: Don't leak SPI master in probe error path



stable inclusion
from stable-5.10.4
commit 3bf639fe0661edc353cc2592ea228fed3a2791dd
bugzilla: 46903

--------------------------------

commit cc53711b upstream.

If the calls to devm_clk_get() or devm_ioremap_resource() fail on probe
of the Macronix SPI driver, the spi_master struct is erroneously not freed.

Fix by switching over to the new devm_spi_alloc_master() helper.

Fixes: b942d80b ("spi: Add MXIC controller driver")
Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v5.0+: 5e844cc3: spi: Introduce device-managed SPI controller allocation
Cc: <stable@vger.kernel.org> # v5.0+
Cc: Mason Yang <masonccyang@mxic.com.tw>
Link: https://lore.kernel.org/r/4fa6857806e7e75741c05d057ac9df3564460114.1607286887.git.lukas@wunner.de


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent cb068f40
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment