Skip to contentSkip to conversation

thermal: imx8mm: Print the correct error code

PATCH Applied Fabio Estevam 2 participants 4 messages Dec 2, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 thermal: imx8mm: Print the correct error code

Currently the error message does not print the correct error code.

Fix it by initializing 'ret' to the proper error code.

---
 drivers/thermal/imx8mm_thermal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/imx8mm_thermal.c +2 -1
index a1e4f9bb4cb0..ce7cb6452c52 100644
@@ -166,10 +166,11 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 							     &tmu->sensors[i],
 							     &tmu_tz_ops);
 		if (IS_ERR(tmu->sensors[i].tzd)) {
+			ret = PTR_ERR(tmu->sensors[i].tzd);
 			dev_err(&pdev->dev,
 				"failed to register thermal zone sensor[%d]: %d\n",
 				i, ret);
-			return PTR_ERR(tmu->sensors[i].tzd);
+			return ret;
 		}
 		tmu->sensors[i].hw_id = i;
 	}
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

PATCH 2/2 thermal: imx8mm: Disable the clock on probe failure

Prior to returning an error in probe, disable the previously enabled clock.

---
 drivers/thermal/imx8mm_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/imx8mm_thermal.c +5 -1
index ce7cb6452c52..7442e013738f 100644
@@ -170,7 +170,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev,
 				"failed to register thermal zone sensor[%d]: %d\n",
 				i, ret);
-			return ret;
+			goto disable_clk;
 		}
 		tmu->sensors[i].hw_id = i;
 	}
@@ -185,6 +185,10 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 	imx8mm_tmu_enable(tmu, true);
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(tmu->clk);
+	return ret;
 }
 
 static int imx8mm_tmu_remove(struct platform_device *pdev)
Signature · 1 line
2.17.1
#2 lore raw

[thermal: thermal/next] thermal: imx8mm: Disable the clock on probe failure

The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     e57eb8b5050c9b6d63eea26b194d96744fe4018a
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//e57eb8b5050c9b6d63eea26b194d96744fe4018a
Author:        Fabio Estevam <[email protected]>
AuthorDate:    Wed, 02 Dec 2020 20:24:48 -03:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Fri, 04 Dec 2020 20:46:03 +01:00

thermal: imx8mm: Disable the clock on probe failure

Prior to returning an error in probe, disable the previously enabled clock.

---
 drivers/thermal/imx8mm_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/imx8mm_thermal.c +5 -1
index ce7cb64..7442e01 100644
@@ -170,7 +170,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev,
 				"failed to register thermal zone sensor[%d]: %d\n",
 				i, ret);
-			return ret;
+			goto disable_clk;
 		}
 		tmu->sensors[i].hw_id = i;
 	}
@@ -185,6 +185,10 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 	imx8mm_tmu_enable(tmu, true);
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(tmu->clk);
+	return ret;
 }
 
 static int imx8mm_tmu_remove(struct platform_device *pdev)
#3 lore raw
In reply to Fabio Estevam
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     ce662ccde5c6ae4f4d89fe71570bf59441004eb9
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//ce662ccde5c6ae4f4d89fe71570bf59441004eb9
Author:        Fabio Estevam <[email protected]>
AuthorDate:    Wed, 02 Dec 2020 20:24:47 -03:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Fri, 04 Dec 2020 20:46:03 +01:00

thermal: imx8mm: Print the correct error code

Currently the error message does not print the correct error code.

Fix it by initializing 'ret' to the proper error code.

---
 drivers/thermal/imx8mm_thermal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/imx8mm_thermal.c +2 -1
index a1e4f9b..ce7cb64 100644
@@ -166,10 +166,11 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 							     &tmu->sensors[i],
 							     &tmu_tz_ops);
 		if (IS_ERR(tmu->sensors[i].tzd)) {
+			ret = PTR_ERR(tmu->sensors[i].tzd);
 			dev_err(&pdev->dev,
 				"failed to register thermal zone sensor[%d]: %d\n",
 				i, ret);
-			return PTR_ERR(tmu->sensors[i].tzd);
+			return ret;
 		}
 		tmu->sensors[i].hw_id = i;
 	}