Other drivers allocate from the SRAM pools and map the reserved regions, with nothing tying their lifetime to the SRAM device. Unbinding it through sysfs destroys the pools under them: sram_remove() notices and prints "removed while SRAM allocated", but carries on, and the devm release of the pool then hits the BUG_ON() in gen_pool_destroy() for the outstanding allocations. Seen on an Armada 385 with the CESA crypto engine holding its buffers in an mmio-sram region: # echo f1100000.sa-sram0 > /sys/bus/platform/drivers/sram/unbind sram f1100000.sa-sram0: removed while SRAM allocated Internal error: Oops - undefined instruction: 0 [#1] SMP ARM The driver cannot be built as a module, so suppress the bind attributes and with them the only way to remove it. Fixes: 4984c6f5e56c ("misc: generic on-chip SRAM allocation driver") Cc: stable@vger.kernel.org Signed-off-by: Rosen Penev --- An AI coding assistant (Claude Code, Claude Opus 5.5) was used to find this while reviewing the CESA driver, reproduce it on the board, and write the patch and its commit message. drivers/misc/sram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index c5110c32f661..fed949de60f5 100644 --- a/drivers/misc/sram.c +++ b/drivers/misc/sram.c @@ -450,6 +450,7 @@ static struct platform_driver sram_driver = { .driver = { .name = "sram", .of_match_table = sram_dt_ids, + .suppress_bind_attrs = true, }, .probe = sram_probe, .remove = sram_remove, base-commit: 917fcbf033154a6c8d83cfa6c88f012b71eb37b2 -- 2.56.1