@@ -125,10 +125,9 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
125
125
126
126
static struct device_node * of_thermal_zone_find (struct device_node * sensor , int id )
127
127
{
128
- struct device_node * np , * tz ;
129
128
struct of_phandle_args sensor_specs ;
130
129
131
- np = of_find_node_by_name (NULL , "thermal-zones" );
130
+ struct device_node * np __free ( device_node ) = of_find_node_by_name (NULL , "thermal-zones" );
132
131
if (!np ) {
133
132
pr_debug ("No thermal zones description\n" );
134
133
return ERR_PTR (- ENODEV );
@@ -146,8 +145,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
146
145
"#thermal-sensor-cells" );
147
146
if (count <= 0 ) {
148
147
pr_err ("%pOFn: missing thermal sensor\n" , child );
149
- tz = ERR_PTR (- EINVAL );
150
- goto out ;
148
+ return ERR_PTR (- EINVAL );
151
149
}
152
150
153
151
for (i = 0 ; i < count ; i ++ ) {
@@ -159,22 +157,18 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
159
157
i , & sensor_specs );
160
158
if (ret < 0 ) {
161
159
pr_err ("%pOFn: Failed to read thermal-sensors cells: %d\n" , child , ret );
162
- tz = ERR_PTR (ret );
163
- goto out ;
160
+ return ERR_PTR (ret );
164
161
}
165
162
166
163
if ((sensor == sensor_specs .np ) && id == (sensor_specs .args_count ?
167
164
sensor_specs .args [0 ] : 0 )) {
168
165
pr_debug ("sensor %pOFn id=%d belongs to %pOFn\n" , sensor , id , child );
169
- tz = no_free_ptr (child );
170
- goto out ;
166
+ return no_free_ptr (child );
171
167
}
172
168
}
173
169
}
174
- tz = ERR_PTR (- ENODEV );
175
- out :
176
- of_node_put (np );
177
- return tz ;
170
+
171
+ return ERR_PTR (- ENODEV );
178
172
}
179
173
180
174
static int thermal_of_monitor_init (struct device_node * np , int * delay , int * pdelay )
0 commit comments