pastebin

Paste #812381: Untitled ASCII paste by 2804:14c:482:22a:18a2:7b63:4439:1287

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 7b364933bfb1..d04a30f287c9 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -2,6 +2,7 @@
 //
 // Copyright 2016 Freescale Semiconductor, Inc.
 
+#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
@@ -72,6 +73,7 @@ struct qoriq_sensor {
 
 struct qoriq_tmu_data {
 	struct qoriq_tmu_regs __iomem *regs;
+	struct clk *clk;
 	bool little_endian;
 	struct qoriq_sensor	*sensor[SITES_MAX];
 };
@@ -202,6 +204,14 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 
 	data->little_endian = of_property_read_bool(np, "little-endian");
 
+	data->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(data->clk))
+		return PTR_ERR(data->clk);
+
+	ret = clk_prepare_enable(data->clk);
+	if (ret < 0)
+		return ret;
+
 	data->regs = of_iomap(np, 0);
 	if (!data->regs) {
 		dev_err(&pdev->dev, "Failed to get memory region\n");
@@ -228,6 +238,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 	iounmap(data->regs);
 
 err_iomap:
+	clk_disable_unprepare(data->clk);
 	platform_set_drvdata(pdev, NULL);
 
 	return ret;
@@ -242,6 +253,7 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 
 	iounmap(data->regs);
 	platform_set_drvdata(pdev, NULL);
+	clk_disable_unprepare(data->clk);
 
 	return 0;
 }
-- 
2.17.1

Private
Wrap long lines

2 + 4 =