Skip to contentSkip to conversation

thermal: return an error on failure to register thermal class

PATCH Applied Richard Guy Briggs 2 participants 2 messages Feb 12, 2013 – Feb 19, 2013 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: return an error on failure to register thermal class

The return code from the registration of the thermal class is used to unallocate resources, but this failure isn't passed back to the caller of thermal_init. Return this failure back to the caller.

This bug was introduced in changeset 4cb18728 which overwrote the return code when the variable was re-used to catch the return code of the registration of the genetlink thermal socket family.

---
 drivers/thermal/thermal_sys.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/thermal_sys.c +1 -0
index 8c8ce80..bfbf9fb 100644
@@ -1807,6 +1807,7 @@ static int __init thermal_init(void)
 		idr_destroy(&thermal_cdev_idr);
 		mutex_destroy(&thermal_idr_lock);
 		mutex_destroy(&thermal_list_lock);
+		return result;
 	}
 	result = genetlink_init();
 	return result;
Signature · 1 line
1.8.0.2
reviewer Applied
#1 lore raw
Quoted 9 lines · Richard Guy Briggs

The return code from the registration of the thermal class is used to unallocate resources, but this failure isn't passed back to the caller of thermal_init. Return this failure back to the caller.

This bug was introduced in changeset 4cb18728 which overwrote the return code when the variable was re-used to catch the return code of the registration of the genetlink thermal socket family.

applied to thermal -next.

thanks,
rui

Quoted 16 lines
---
 drivers/thermal/thermal_sys.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/thermal_sys.c +1 -0
index 8c8ce80..bfbf9fb 100644
@@ -1807,6 +1807,7 @@ static int __init thermal_init(void)
 		idr_destroy(&thermal_cdev_idr);
 		mutex_destroy(&thermal_idr_lock);
 		mutex_destroy(&thermal_list_lock);
+		return result;
 	}
 	result = genetlink_init();
 	return result;