Commit 6c54b7b
thermal: core: call put_device() only after device_register() fails
put_device() shouldn't be called before a prior call to
device_register(). __thermal_cooling_device_register() doesn't follow
that properly and needs fixing. Also
thermal_cooling_device_destroy_sysfs() is getting called unnecessarily
on few error paths.
Fix all this by placing the calls at the right place.
Based on initial work done by Caleb Connolly.
Fixes: 4748f96 ("thermal: core: fix some possible name leaks in error paths")
Fixes: c408b3d ("thermal: Validate new state in cur_state_store()")
Reported-by: Caleb Connolly <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
Tested-by: Frank Rowand <[email protected]>
Reviewed-by: Yang Yingliang <[email protected]>
Tested-by: Caleb Connolly <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>1 parent 5dc4c99 commit 6c54b7b
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
912 | | - | |
913 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
914 | 916 | | |
915 | 917 | | |
| 918 | + | |
916 | 919 | | |
917 | 920 | | |
| 921 | + | |
918 | 922 | | |
919 | | - | |
| 923 | + | |
920 | 924 | | |
| 925 | + | |
921 | 926 | | |
922 | 927 | | |
923 | 928 | | |
| |||
943 | 948 | | |
944 | 949 | | |
945 | 950 | | |
| 951 | + | |
| 952 | + | |
946 | 953 | | |
947 | 954 | | |
948 | 955 | | |
| |||
0 commit comments