Skip to contentSkip to conversation

drivers/thermal: cleanup coding style a bit

PATCH RESEND Applied Bernard 2 participants 2 messages Nov 10, 2020 – Nov 12, 2020 Thermal

lore
Share & tools
lore

Bernard

author
#0 lore raw

PATCH RESEND 1/1 drivers/thermal: cleanup coding style a bit

Function thermal_add_hwmon_sysfs, hwmon will be NULL when new_hwmon_device = 0, so there is no need to check, kfree will handle NULL point.

---
 drivers/thermal/thermal_hwmon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/thermal_hwmon.c +1 -2
index 8b92e00ff236..ad03262cca56 100644
@@ -206,8 +206,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 	if (new_hwmon_device)
 		hwmon_device_unregister(hwmon->device);
  free_mem:
-	if (new_hwmon_device)
-		kfree(hwmon);
+	kfree(hwmon);
 
 	return result;
 }
Signature · 1 line
2.29.0
#1 lore raw
Quoted 6 lines · Bernard

Function thermal_add_hwmon_sysfs, hwmon will be NULL when new_hwmon_device = 0, so there is no need to check, kfree will handle NULL point.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog