Commit f294d009 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

misc: sram: fix resource leaks in probe error path

Make sure to disable clocks and deregister any exported partitions
before returning on late probe errors.

Note that since commit ee895ccd ("misc: sram: fix enabled clock leak
on error path"), partitions are deliberately exported before enabling
the clock so we stick to that logic here. A follow up patch will address

Fixes: 2ae2e288

 ("misc: sram: add Atmel securam support")
Cc: stable <>     # 4.9
Cc: Alexandre Belloni <>
Signed-off-by: default avatarJohan Hovold <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 3cfaeb33
......@@ -407,13 +407,20 @@ static int sram_probe(struct platform_device *pdev)
if (init_func) {
ret = init_func();
if (ret)
return ret;
goto err_disable_clk;
dev_dbg(sram->dev, "SRAM pool: %zu KiB @ 0x%p\n",
gen_pool_size(sram->pool) / 1024, sram->virt_base);
return 0;
if (sram->clk)
return ret;
static int sram_remove(struct platform_device *pdev)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment