File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -901,23 +901,35 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
901
901
result = sysfs_create_link (& tz -> device -> dev .kobj ,
902
902
& tz -> thermal_zone -> device .kobj , "thermal_zone" );
903
903
if (result )
904
- return result ;
904
+ goto unregister_tzd ;
905
905
906
906
result = sysfs_create_link (& tz -> thermal_zone -> device .kobj ,
907
907
& tz -> device -> dev .kobj , "device" );
908
908
if (result )
909
- return result ;
909
+ goto remove_tz_link ;
910
910
911
911
status = acpi_bus_attach_private_data (tz -> device -> handle ,
912
912
tz -> thermal_zone );
913
- if (ACPI_FAILURE (status ))
914
- return - ENODEV ;
913
+ if (ACPI_FAILURE (status )) {
914
+ result = - ENODEV ;
915
+ goto remove_dev_link ;
916
+ }
915
917
916
918
tz -> tz_enabled = 1 ;
917
919
918
920
dev_info (& tz -> device -> dev , "registered as thermal_zone%d\n" ,
919
921
tz -> thermal_zone -> id );
922
+
920
923
return 0 ;
924
+
925
+ remove_dev_link :
926
+ sysfs_remove_link (& tz -> thermal_zone -> device .kobj , "device" );
927
+ remove_tz_link :
928
+ sysfs_remove_link (& tz -> device -> dev .kobj , "thermal_zone" );
929
+ unregister_tzd :
930
+ thermal_zone_device_unregister (tz -> thermal_zone );
931
+
932
+ return result ;
921
933
}
922
934
923
935
static void acpi_thermal_unregister_thermal_zone (struct acpi_thermal * tz )
You can’t perform that action at this time.
0 commit comments