Use goto to avoid repeating resource deallocation code.

Signed-off-by: Andrey Smirnov <[email protected]>
Cc: Chris Healy <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Eduardo Valentin <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 drivers/thermal/qoriq_thermal.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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);
 
-- 
2.20.1

Reply via email to