lkml.org 
[lkml]   [2015]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/9] misc: sram: fix enabled clock leak on error path
Date
If devm_gen_pool_create() fails, the previously enabled sram->clk is
not disabled on probe() exit.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
drivers/misc/sram.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index eeaaf5f..b44a423 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -90,16 +90,17 @@ static int sram_probe(struct platform_device *pdev)
if (!sram)
return -ENOMEM;

+ sram->pool = devm_gen_pool_create(&pdev->dev,
+ ilog2(SRAM_GRANULARITY), -1);
+ if (!sram->pool)
+ return -ENOMEM;
+
sram->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(sram->clk))
sram->clk = NULL;
else
clk_prepare_enable(sram->clk);

- sram->pool = devm_gen_pool_create(&pdev->dev, ilog2(SRAM_GRANULARITY), -1);
- if (!sram->pool)
- return -ENOMEM;
-
/*
* We need an additional block to mark the end of the memory region
* after the reserved blocks from the dt are processed.
--
2.1.4


\
 
 \ /
  Last update: 2015-05-18 21:21    [W:1.745 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site