[10/12] thermal: qoriq: Simplify error handling in qoriq_tmu_get_sensor_id()
diff mbox series

Message ID 20190218191141.3729-11-andrew.smirnov@gmail.com
State Changes Requested
Delegated to: Eduardo Valentin
Headers show
Series
  • QorIQ TMU multi-sensor and HWMON support
Related show

Commit Message

Andrey Smirnov Feb. 18, 2019, 7:11 p.m. UTC
Use goto to avoid repeating resource deallocation code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-imx@nxp.com
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/thermal/qoriq_thermal.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 3d520d3b2da4..d4f5e180e1ee 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -78,9 +78,8 @@  static int qoriq_tmu_get_sensor_id(void)
 			"#thermal-sensor-cells",
 			0, &sensor_specs);
 	if (ret) {
-		of_node_put(np);
-		of_node_put(sensor_np);
-		return ret;
+		id = ret;
+		goto out;
 	}
 
 	if (sensor_specs.args_count >= 1) {
@@ -91,7 +90,7 @@  static int qoriq_tmu_get_sensor_id(void)
 	} else {
 		id = 0;
 	}
-
+out:
 	of_node_put(np);
 	of_node_put(sensor_np);