Skip to contentSkip to conversation

drivers/thermal: cleanup coding style a bit

PATCH Applied Bernard Zhao 2 participants 2 messages Nov 2, 2020 – Nov 24, 2020 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 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

[thermal: thermal/next] thermal/drivers/hwmon: Cleanup coding style a bit

The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     030a48b0f6ce393d78b8d33debb1e2043b8cc156
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//030a48b0f6ce393d78b8d33debb1e2043b8cc156
Author:        Bernard Zhao <[email protected]>
AuthorDate:    Sun, 01 Nov 2020 18:31:21 -08:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Thu, 12 Nov 2020 11:24:01 +01:00

thermal/drivers/hwmon: 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 8b92e00..ad03262 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;
 }