Skip to content

Commit 111e286

Browse files
outman119broonie
authored andcommitted
spi: rockchip-sfc: Fix double-free in remove() callback
The driver uses devm_spi_register_controller() for registration, which automatically unregisters the controller via devm cleanup when the device is removed. The manual call to spi_unregister_controller() in the remove() callback can lead to a double-free. And to make sure controller is unregistered before DMA buffer is unmapped, switch to use spi_register_controller() in probe(). Fixes: 8011709 ("spi: rockchip-sfc: Support pm ops") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Link: https://patch.msgid.link/20260310-sfc-v2-1-67fab04b097f@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent ad0e9ac commit 111e286

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/spi/spi-rockchip-sfc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ static int rockchip_sfc_probe(struct platform_device *pdev)
711711
}
712712
}
713713

714-
ret = devm_spi_register_controller(dev, host);
714+
ret = spi_register_controller(host);
715715
if (ret)
716716
goto err_register;
717717

0 commit comments

Comments
 (0)