Commit bec21d9
spi: amlogic-spisg: Fix memory leak in aml_spisg_probe()
[ Upstream commit b8db955 ]
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: cef9991 ("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>1 parent f15e070 commit bec21d9
1 file changed
+4
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | | - | |
| 732 | + | |
733 | 733 | | |
734 | | - | |
| 734 | + | |
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
| 753 | + | |
| 754 | + | |
757 | 755 | | |
758 | 756 | | |
759 | 757 | | |
| |||
818 | 816 | | |
819 | 817 | | |
820 | 818 | | |
821 | | - | |
822 | | - | |
823 | 819 | | |
824 | 820 | | |
825 | 821 | | |
| |||
0 commit comments