summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/cpufreq_cooling.c7
-rw-r--r--drivers/thermal/cpuidle_cooling.c2
-rw-r--r--drivers/thermal/devfreq_cooling.c2
-rw-r--r--drivers/thermal/gov_power_allocator.c7
-rw-r--r--drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c6
-rw-r--r--drivers/thermal/intel/int340x_thermal/int3400_thermal.c10
-rw-r--r--drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c7
-rw-r--r--drivers/thermal/intel/intel_hfi.c6
-rw-r--r--drivers/thermal/intel/intel_quark_dts_thermal.c2
-rw-r--r--drivers/thermal/intel/intel_soc_dts_iosf.c2
-rw-r--r--drivers/thermal/intel/x86_pkg_temp_thermal.c5
-rw-r--r--drivers/thermal/k3_j72xx_bandgap.c2
-rw-r--r--drivers/thermal/testing/zone.c21
-rw-r--r--drivers/thermal/thermal_core.c8
-rw-r--r--drivers/thermal/thermal_debugfs.c8
-rw-r--r--drivers/thermal/thermal_hwmon.c4
-rw-r--r--drivers/thermal/thermal_of.c3
-rw-r--r--drivers/thermal/thermal_sysfs.c4
-rw-r--r--drivers/thermal/thermal_thresholds.c2
19 files changed, 55 insertions, 53 deletions
diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index 6b7ab1814c12..d0bb782ff734 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -371,9 +371,8 @@ static int allocate_idle_time(struct cpufreq_cooling_device *cpufreq_cdev)
{
unsigned int num_cpus = cpumask_weight(cpufreq_cdev->policy->related_cpus);
- cpufreq_cdev->idle_time = kcalloc(num_cpus,
- sizeof(*cpufreq_cdev->idle_time),
- GFP_KERNEL);
+ cpufreq_cdev->idle_time = kzalloc_objs(*cpufreq_cdev->idle_time,
+ num_cpus, GFP_KERNEL);
if (!cpufreq_cdev->idle_time)
return -ENOMEM;
@@ -543,7 +542,7 @@ __cpufreq_cooling_register(struct device_node *np,
return ERR_PTR(-ENODEV);
}
- cpufreq_cdev = kzalloc(sizeof(*cpufreq_cdev), GFP_KERNEL);
+ cpufreq_cdev = kzalloc_obj(*cpufreq_cdev, GFP_KERNEL);
if (!cpufreq_cdev)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_cooling.c
index f678c1281862..5a16d4e7e698 100644
--- a/drivers/thermal/cpuidle_cooling.c
+++ b/drivers/thermal/cpuidle_cooling.c
@@ -179,7 +179,7 @@ static int __cpuidle_cooling_register(struct device_node *np,
char *name;
int ret;
- idle_cdev = kzalloc(sizeof(*idle_cdev), GFP_KERNEL);
+ idle_cdev = kzalloc_obj(*idle_cdev, GFP_KERNEL);
if (!idle_cdev) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index 8fd7cf1932cd..72fb23de5f55 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -402,7 +402,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
int err, num_opps;
- dfc = kzalloc(sizeof(*dfc), GFP_KERNEL);
+ dfc = kzalloc_obj(*dfc, GFP_KERNEL);
if (!dfc)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 0d9f636c80f4..696932ecb489 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -622,8 +622,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
goto clean_state;
}
- params->power = kcalloc(num_actors, sizeof(struct power_actor),
- GFP_KERNEL);
+ params->power = kzalloc_objs(struct power_actor, num_actors, GFP_KERNEL);
if (!params->power) {
ret = -ENOMEM;
goto clean_state;
@@ -699,7 +698,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
struct power_allocator_params *params;
int ret;
- params = kzalloc(sizeof(*params), GFP_KERNEL);
+ params = kzalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
@@ -720,7 +719,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
}
if (!tz->tzp) {
- tz->tzp = kzalloc(sizeof(*tz->tzp), GFP_KERNEL);
+ tz->tzp = kzalloc_obj(*tz->tzp, GFP_KERNEL);
if (!tz->tzp) {
ret = -ENOMEM;
goto free_params;
diff --git a/drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c
index ce5d53be108b..d1876e76167a 100644
--- a/drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c
@@ -89,7 +89,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
}
*trt_count = p->package.count;
- trts = kcalloc(*trt_count, sizeof(struct trt), GFP_KERNEL);
+ trts = kzalloc_objs(struct trt, *trt_count, GFP_KERNEL);
if (!trts) {
result = -ENOMEM;
goto end;
@@ -165,7 +165,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
/* ignore p->package.elements[0], as this is _ART Revision field */
*art_count = p->package.count - 1;
- arts = kcalloc(*art_count, sizeof(struct art), GFP_KERNEL);
+ arts = kzalloc_objs(struct art, *art_count, GFP_KERNEL);
if (!arts) {
result = -ENOMEM;
goto end;
@@ -253,7 +253,7 @@ static int acpi_parse_psvt(acpi_handle handle, int *psvt_count, struct psvt **ps
goto end;
}
- psvts = kcalloc(*psvt_count, sizeof(*psvts), GFP_KERNEL);
+ psvts = kzalloc_objs(*psvts, *psvt_count, GFP_KERNEL);
if (!psvts) {
result = -ENOMEM;
goto end;
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 41d3bc3ed8a2..3a97718e2f5c 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -382,8 +382,7 @@ static int evaluate_odvp(struct int3400_thermal_priv *priv)
if (priv->odvp == NULL) {
priv->odvp_count = obj->package.count;
- priv->odvp = kmalloc_array(priv->odvp_count, sizeof(int),
- GFP_KERNEL);
+ priv->odvp = kmalloc_objs(int, priv->odvp_count, GFP_KERNEL);
if (!priv->odvp) {
ret = -ENOMEM;
goto out_err;
@@ -391,9 +390,8 @@ static int evaluate_odvp(struct int3400_thermal_priv *priv)
}
if (priv->odvp_attrs == NULL) {
- priv->odvp_attrs = kcalloc(priv->odvp_count,
- sizeof(struct odvp_attr),
- GFP_KERNEL);
+ priv->odvp_attrs = kzalloc_objs(struct odvp_attr,
+ priv->odvp_count, GFP_KERNEL);
if (!priv->odvp_attrs) {
ret = -ENOMEM;
goto out_err;
@@ -563,7 +561,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
if (!adev)
return -ENODEV;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
index 3d9efe69d562..7db8fd86c4fd 100644
--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -123,7 +123,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
acpi_status status;
int i, ret;
- int34x_zone = kzalloc(sizeof(*int34x_zone), GFP_KERNEL);
+ int34x_zone = kzalloc_obj(*int34x_zone, GFP_KERNEL);
if (!int34x_zone)
return ERR_PTR(-ENOMEM);
@@ -133,8 +133,9 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
if (ACPI_SUCCESS(status))
int34x_zone->aux_trip_nr = trip_cnt;
- zone_trips = kcalloc(trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT,
- sizeof(*zone_trips), GFP_KERNEL);
+ zone_trips = kzalloc_objs(*zone_trips,
+ trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT,
+ GFP_KERNEL);
if (!zone_trips) {
ret = -ENOMEM;
goto err_trips_alloc;
diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
index 8a2f441cd2ec..5100ad1336ed 100644
--- a/drivers/thermal/intel/intel_hfi.c
+++ b/drivers/thermal/intel/intel_hfi.c
@@ -212,7 +212,7 @@ static void update_capabilities(struct hfi_instance *hfi_instance)
if (!cpu_count)
goto out;
- cpu_caps = kcalloc(cpu_count, sizeof(*cpu_caps), GFP_KERNEL);
+ cpu_caps = kzalloc_objs(*cpu_caps, cpu_count, GFP_KERNEL);
if (!cpu_caps)
goto out;
@@ -690,8 +690,8 @@ void __init intel_hfi_init(void)
* This allocation may fail. CPU hotplug callbacks must check
* for a null pointer.
*/
- hfi_instances = kcalloc(max_hfi_instances, sizeof(*hfi_instances),
- GFP_KERNEL);
+ hfi_instances = kzalloc_objs(*hfi_instances, max_hfi_instances,
+ GFP_KERNEL);
if (!hfi_instances)
return;
diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c
index 89498eb29a89..38a0ae14b69d 100644
--- a/drivers/thermal/intel/intel_quark_dts_thermal.c
+++ b/drivers/thermal/intel/intel_quark_dts_thermal.c
@@ -336,7 +336,7 @@ static struct soc_sensor_entry *alloc_soc_dts(void)
int err;
u32 out;
- aux_entry = kzalloc(sizeof(*aux_entry), GFP_KERNEL);
+ aux_entry = kzalloc_obj(*aux_entry, GFP_KERNEL);
if (!aux_entry) {
err = -ENOMEM;
return ERR_PTR(-ENOMEM);
diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index ea87439fe7a9..78123107ac06 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -320,7 +320,7 @@ intel_soc_dts_iosf_init(enum intel_soc_dts_interrupt_type intr_type,
if (tj_max < 0)
return ERR_PTR(tj_max);
- sensors = kzalloc(sizeof(*sensors), GFP_KERNEL);
+ sensors = kzalloc_obj(*sensors, GFP_KERNEL);
if (!sensors)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
index aab5f9fca9c3..64cc0361d440 100644
--- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
@@ -335,7 +335,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
return tj_max;
tj_max *= 1000;
- zonedev = kzalloc(sizeof(*zonedev), GFP_KERNEL);
+ zonedev = kzalloc_obj(*zonedev, GFP_KERNEL);
if (!zonedev)
return -ENOMEM;
@@ -492,8 +492,7 @@ static int __init pkg_temp_thermal_init(void)
return -ENODEV;
max_id = topology_max_packages() * topology_max_dies_per_package();
- zones = kcalloc(max_id, sizeof(struct zone_device *),
- GFP_KERNEL);
+ zones = kzalloc_objs(struct zone_device *, max_id, GFP_KERNEL);
if (!zones)
return -ENOMEM;
diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
index d9ec3bf19496..138a8137f790 100644
--- a/drivers/thermal/k3_j72xx_bandgap.c
+++ b/drivers/thermal/k3_j72xx_bandgap.c
@@ -462,7 +462,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
goto err_alloc;
}
- ref_table = kcalloc(TABLE_SIZE, sizeof(*ref_table), GFP_KERNEL);
+ ref_table = kzalloc_objs(*ref_table, TABLE_SIZE, GFP_KERNEL);
if (!ref_table) {
ret = -ENOMEM;
goto err_alloc;
diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c
index c12c405225bb..014e6e5f0e83 100644
--- a/drivers/thermal/testing/zone.c
+++ b/drivers/thermal/testing/zone.c
@@ -186,12 +186,13 @@ int tt_add_tz(void)
{
int ret;
- struct tt_thermal_zone *tt_zone __free(kfree) = kzalloc(sizeof(*tt_zone),
- GFP_KERNEL);
+ struct tt_thermal_zone *tt_zone __free(kfree) = kzalloc_obj(*tt_zone,
+ GFP_KERNEL);
if (!tt_zone)
return -ENOMEM;
- struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc_obj(*tt_work,
+ GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
@@ -244,7 +245,8 @@ int tt_del_tz(const char *arg)
if (ret != 1)
return -EINVAL;
- struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc_obj(*tt_work,
+ GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
@@ -330,11 +332,13 @@ int tt_zone_add_trip(const char *arg)
{
int id;
- struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc_obj(*tt_work,
+ GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
- struct tt_trip *tt_trip __free(kfree) = kzalloc(sizeof(*tt_trip), GFP_KERNEL);
+ struct tt_trip *tt_trip __free(kfree) = kzalloc_obj(*tt_trip,
+ GFP_KERNEL);
if (!tt_trip)
return -ENOMEM;
@@ -391,8 +395,9 @@ static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
if (tt_zone->tz)
return -EINVAL;
- struct thermal_trip *trips __free(kfree) = kcalloc(tt_zone->num_trips,
- sizeof(*trips), GFP_KERNEL);
+ struct thermal_trip *trips __free(kfree) = kzalloc_objs(*trips,
+ tt_zone->num_trips,
+ GFP_KERNEL);
if (!trips)
return -ENOMEM;
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index dc9f7416f7ff..daaba832b2a0 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -844,7 +844,7 @@ static int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
if (cool_spec->lower > cool_spec->upper || cool_spec->upper > cdev->max_state)
return -EINVAL;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
@@ -1070,7 +1070,7 @@ __thermal_cooling_device_register(struct device_node *np,
if (!thermal_class)
return ERR_PTR(-ENODEV);
- cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
+ cdev = kzalloc_obj(*cdev, GFP_KERNEL);
if (!cdev)
return ERR_PTR(-ENOMEM);
@@ -1542,7 +1542,7 @@ thermal_zone_device_register_with_trips(const char *type,
if (!thermal_class)
return ERR_PTR(-ENODEV);
- tz = kzalloc(struct_size(tz, trips, num_trips), GFP_KERNEL);
+ tz = kzalloc_flex(*tz, trips, num_trips, GFP_KERNEL);
if (!tz)
return ERR_PTR(-ENOMEM);
@@ -1899,7 +1899,7 @@ static int __init thermal_init(void)
if (result)
goto unregister_netlink;
- thermal_class = kzalloc(sizeof(*thermal_class), GFP_KERNEL);
+ thermal_class = kzalloc_obj(*thermal_class, GFP_KERNEL);
if (!thermal_class) {
result = -ENOMEM;
goto unregister_governors;
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index 11668f5b3c28..19b050cb4f70 100644
--- a/drivers/thermal/thermal_debugfs.c
+++ b/drivers/thermal/thermal_debugfs.c
@@ -193,7 +193,7 @@ static struct thermal_debugfs *thermal_debugfs_add_id(struct dentry *d, int id)
struct thermal_debugfs *thermal_dbg;
char ids[IDSLENGTH];
- thermal_dbg = kzalloc(sizeof(*thermal_dbg), GFP_KERNEL);
+ thermal_dbg = kzalloc_obj(*thermal_dbg, GFP_KERNEL);
if (!thermal_dbg)
return NULL;
@@ -226,7 +226,7 @@ thermal_debugfs_cdev_record_alloc(struct thermal_debugfs *thermal_dbg,
{
struct cdev_record *cdev_record;
- cdev_record = kzalloc(sizeof(*cdev_record), GFP_KERNEL);
+ cdev_record = kzalloc_obj(*cdev_record, GFP_KERNEL);
if (!cdev_record)
return NULL;
@@ -559,7 +559,7 @@ static struct tz_episode *thermal_debugfs_tz_event_alloc(struct thermal_zone_dev
struct tz_episode *tze;
int i;
- tze = kzalloc(struct_size(tze, trip_stats, tz->num_trips), GFP_KERNEL);
+ tze = kzalloc_flex(*tze, trip_stats, tz->num_trips, GFP_KERNEL);
if (!tze)
return NULL;
@@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device *tz)
tz_dbg->tz = tz;
- tz_dbg->trips_crossed = kcalloc(tz->num_trips, sizeof(int), GFP_KERNEL);
+ tz_dbg->trips_crossed = kzalloc_objs(int, tz->num_trips, GFP_KERNEL);
if (!tz_dbg->trips_crossed) {
thermal_debugfs_remove_id(thermal_dbg);
return;
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index faf1d0083890..f377175b2663 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -145,7 +145,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
goto register_sys_interface;
}
- hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
+ hwmon = kzalloc_obj(*hwmon, GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
@@ -160,7 +160,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
}
register_sys_interface:
- temp = kzalloc(sizeof(*temp), GFP_KERNEL);
+ temp = kzalloc_obj(*temp, GFP_KERNEL);
if (!temp) {
result = -ENOMEM;
goto unregister_name;
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index b6d0c92f5522..085a414d874b 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -107,7 +107,8 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
if (!count)
return NULL;
- struct thermal_trip *tt __free(kfree) = kcalloc(count, sizeof(*tt), GFP_KERNEL);
+ struct thermal_trip *tt __free(kfree) = kzalloc_objs(*tt, count,
+ GFP_KERNEL);
if (!tt)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 2538c2dcf6a9..057460b2e7bb 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -392,7 +392,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
struct attribute **attrs;
int i;
- attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL);
+ attrs = kzalloc_objs(*attrs, tz->num_trips * 3 + 1, GFP_KERNEL);
if (!attrs)
return -ENOMEM;
@@ -465,7 +465,7 @@ int thermal_zone_create_device_groups(struct thermal_zone_device *tz)
/* we need one extra for trips and the NULL to terminate the array */
size = ARRAY_SIZE(thermal_zone_attribute_groups) + 2;
/* This also takes care of API requirement to be NULL terminated */
- groups = kcalloc(size, sizeof(*groups), GFP_KERNEL);
+ groups = kzalloc_objs(*groups, size, GFP_KERNEL);
if (!groups)
return -ENOMEM;
diff --git a/drivers/thermal/thermal_thresholds.c b/drivers/thermal/thermal_thresholds.c
index 38f5fd0e8930..421ddf907b6d 100644
--- a/drivers/thermal/thermal_thresholds.c
+++ b/drivers/thermal/thermal_thresholds.c
@@ -181,7 +181,7 @@ int thermal_thresholds_add(struct thermal_zone_device *tz,
t->direction |= direction;
} else {
- t = kmalloc(sizeof(*t), GFP_KERNEL);
+ t = kmalloc_obj(*t, GFP_KERNEL);
if (!t)
return -ENOMEM;