Skip to contentSkip to conversation

ata: pata_samsung_cf: Use devm_clk_get()

PATCH Superseded Jingoo Han 2 participants 2 messages Jan 9, 2013 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 ata: pata_samsung_cf: Use devm_clk_get()

The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_clk_get() for these functions. These make the code smaller and a bit simpler.

---
 drivers/ata/pata_samsung_cf.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/ata/pata_samsung_cf.c +1 -3
index 63ffb00..70b0e01 100644
@@ -512,7 +512,7 @@ static int __init pata_s3c_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	info->clk = clk_get(&pdev->dev, "cfcon");
+	info->clk = devm_clk_get(&pdev->dev, "cfcon");
 	if (IS_ERR(info->clk)) {
 		dev_err(dev, "failed to get access to cf controller clock\n");
 		ret = PTR_ERR(info->clk);
@@ -589,7 +589,6 @@ static int __init pata_s3c_probe(struct platform_device *pdev)
 
 stop_clk:
 	clk_disable(info->clk);
-	clk_put(info->clk);
 	return ret;
 }
 
@@ -601,7 +600,6 @@ static int __exit pata_s3c_remove(struct platform_device *pdev)
 	ata_host_detach(host);
 
 	clk_disable(info->clk);
-	clk_put(info->clk);
 
 	return 0;
 }
Signature · 1 line
1.7.2.5
#1 lore raw

Hello.

Quoted 2 lines · Jingoo Han

The devm_ functions allocate memory that is released when a driver detaches.

They don't do only that.

Quoted 1 line

This patch uses devm_clk_get() for these functions.

Which doesn't allocate any memory.

Quoted 3 lines

These make the code smaller and a bit simpler.

MBR, Sergei