Thermal_tz_idr, thermal_cdev_idr, thermal_idr_lock and thermal_list_lock are only initialized in the thermal_zone_device_register(). The fucntion has not been invoked before here. So these variables have not been initialized. It doesn't need to destroy them after class_register failed. Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> --- drivers/thermal/thermal_sys.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) Index: linux-2.6/drivers/thermal/thermal_sys.c =================================================================== --- linux-2.6.orig/drivers/thermal/thermal_sys.c +++ linux-2.6/drivers/thermal/thermal_sys.c @@ -1314,12 +1314,9 @@ int result = 0; result = class_register(&thermal_class); - if (result) { - idr_destroy(&thermal_tz_idr); - idr_destroy(&thermal_cdev_idr); - mutex_destroy(&thermal_idr_lock); - mutex_destroy(&thermal_list_lock); - } + if (result) + return result; + result = genetlink_init(); return result; } -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html