Commit 9d9ca1f
thermal: core: Fix resources release in error paths in thermal_zone_device_register()
Reorder error handling code in order to fix some resources leaks in some
cases:
- 'tz' would leak if 'thermal_zone_create_device_groups()' fails
- memory allocated by 'thermal_zone_create_device_groups()' would leak
if 'device_register()' fails
With this patch, we now have 2 error handling paths: one before
'device_register()', and one after it.
This is needed because some resources are released in 'thermal_release()'.
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Zhang Rui <[email protected]>1 parent 6a6cd25 commit 9d9ca1f
1 file changed
+13
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1209 | 1209 | | |
1210 | 1210 | | |
1211 | 1211 | | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
| 1212 | + | |
| 1213 | + | |
1216 | 1214 | | |
1217 | 1215 | | |
1218 | 1216 | | |
| |||
1228 | 1226 | | |
1229 | 1227 | | |
1230 | 1228 | | |
1231 | | - | |
| 1229 | + | |
1232 | 1230 | | |
1233 | 1231 | | |
1234 | 1232 | | |
1235 | 1233 | | |
1236 | 1234 | | |
1237 | 1235 | | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
| 1236 | + | |
| 1237 | + | |
1243 | 1238 | | |
1244 | 1239 | | |
1245 | 1240 | | |
| |||
1293 | 1288 | | |
1294 | 1289 | | |
1295 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
1296 | 1299 | | |
1297 | 1300 | | |
1298 | 1301 | | |
| |||
0 commit comments