spi: spi-altera-dfl: Fix an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 29 May 2022 06:31:53 +0000 (08:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:06 +0000 (14:23 +0200)
commit1f4bc0604dff522cd5d934e7587af5b217f9803a
tree61c8aacfdb896e5e3a8422f842a04631fe1b8cf0
parentebbd1412ce4fbd11b85893a79cdeab7d1acc1dcd
spi: spi-altera-dfl: Fix an error handling path

[ Upstream commit 8e3ca32f46994e74b7f43c57731150b2aedb2630 ]

The spi_alloc_master() call is not undone in all error handling paths.
Moreover, there is no .remove function to release the allocated memory.

In order to fix both this issues, switch to devm_spi_alloc_master().

This allows further simplification of the probe.

Fixes: ba2fc167e944 ("spi: altera: Add DFL bus driver for Altera API Controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/0607bb59f4073f86abe5c585d35245aef0b045c6.1653805901.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-altera-dfl.c