thermal: core: Use the new 'thermal_zone_destroy_device_groups()' helper function
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Tue, 8 Aug 2017 14:39:53 +0000 (16:39 +0200)
committerZhang Rui <rui.zhang@intel.com>
Fri, 11 Aug 2017 03:34:00 +0000 (11:34 +0800)
Simplify code by using the new 'thermal_zone_destroy_device_groups()'
helper function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/thermal_core.c

index 671e4d1..0240c44 100644 (file)
@@ -836,11 +836,7 @@ static void thermal_release(struct device *dev)
        if (!strncmp(dev_name(dev), "thermal_zone",
                     sizeof("thermal_zone") - 1)) {
                tz = to_thermal_zone(dev);
-               kfree(tz->trip_type_attrs);
-               kfree(tz->trip_temp_attrs);
-               kfree(tz->trip_hyst_attrs);
-               kfree(tz->trips_attribute_group.attrs);
-               kfree(tz->device.groups);
+               thermal_zone_destroy_device_groups(tz);
                kfree(tz);
        } else if (!strncmp(dev_name(dev), "cooling_device",
                            sizeof("cooling_device") - 1)) {