[v2] mtd: rawnand: tango: Fix struct clk memory leak

Message ID 8cffd501-b83f-8140-9cc6-021fcd90e277@sigmadesigns.com
State New
Delegated to: Boris Brezillon
Headers show
Series
  • [v2] mtd: rawnand: tango: Fix struct clk memory leak
Related show

Commit Message

Marc Gonzalez April 5, 2018, 12:57 p.m.
Use devm_clk_get() to let Linux manage struct clk memory.

Fixes: 6956e2385a16 ("add tango NAND flash controller support")
Reported-by: Xidong Wang <wangxidong_97@163.com>
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
---
Missing clk_prepare_enable() would be handled in a separate patch.
---
 drivers/mtd/nand/tango_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miquel Raynal April 5, 2018, 2:22 p.m. | #1
Hi Marc,

On Thu, 5 Apr 2018 14:57:59 +0200, Marc Gonzalez
<marc_gonzalez@sigmadesigns.com> wrote:

> Use devm_clk_get() to let Linux manage struct clk memory.
> 
> Fixes: 6956e2385a16 ("add tango NAND flash controller support")
> Reported-by: Xidong Wang <wangxidong_97@163.com>
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> ---
> Missing clk_prepare_enable() would be handled in a separate patch.
> ---
>  drivers/mtd/nand/tango_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/tango_nand.c b/drivers/mtd/nand/tango_nand.c
> index c5bee00b7f5e..76761b841f1f 100644
> --- a/drivers/mtd/nand/tango_nand.c
> +++ b/drivers/mtd/nand/tango_nand.c
> @@ -643,7 +643,7 @@ static int tango_nand_probe(struct platform_device *pdev)
>  
>  	writel_relaxed(MODE_RAW, nfc->pbus_base + PBUS_PAD_MODE);
>  
> -	clk = clk_get(&pdev->dev, NULL);
> +	clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(clk))
>  		return PTR_ERR(clk);
>  

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

Patch

diff --git a/drivers/mtd/nand/tango_nand.c b/drivers/mtd/nand/tango_nand.c
index c5bee00b7f5e..76761b841f1f 100644
--- a/drivers/mtd/nand/tango_nand.c
+++ b/drivers/mtd/nand/tango_nand.c
@@ -643,7 +643,7 @@  static int tango_nand_probe(struct platform_device *pdev)
 
 	writel_relaxed(MODE_RAW, nfc->pbus_base + PBUS_PAD_MODE);
 
-	clk = clk_get(&pdev->dev, NULL);
+	clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);