Skip to content

Commit c3b659b

Browse files
committed
Merge branches 'thermal-core' and 'thermal-misc'
Merge thermal core updates and miscellaneous updates of the thermal control subsystem for 6.15-rc1: - Delay exposing thermal zone sysfs interface to prevent user space from accessing thermal zones that have not been completely initialized yet (Lucas De Marchi). - Fix a spelling mistake in a comment in the thermal core (Colin Ian King). - Use kcalloc() instead of kzalloc() in some places in the thermal control subsystem (Lukasz Luba, Ethan Carter Edwards). - Clean up variable initialization in int340x_thermal_zone_add() (Christophe JAILLET). * thermal-core: thermal: core: Delay exposing sysfs interface thermal: core: Fix spelling mistake "Occurences" -> "Occurrences" * thermal-misc: thermal: intel: Clean up zone_trips[] initialization in int340x_thermal_zone_add() thermal: hisi: Use kcalloc() instead of kzalloc() with multiplication thermal: int340x: Use kcalloc() instead of kzalloc() with multiplication thermal: k3_j72xx_bandgap: Use kcalloc() instead of kzalloc() thermal/of: Use kcalloc() instead of kzalloc() with multiplication thermal/debugfs: replace kzalloc() with kcalloc() in thermal_debug_tz_add()
3 parents 2542a3f + ff63b62 + 067345f commit c3b659b

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

drivers/thermal/hisi_thermal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
412412

413413
data->nr_sensors = 1;
414414

415-
data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) *
416-
data->nr_sensors, GFP_KERNEL);
415+
data->sensor = devm_kcalloc(dev, data->nr_sensors,
416+
sizeof(*data->sensor), GFP_KERNEL);
417417
if (!data->sensor)
418418
return -ENOMEM;
419419

drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
133133
if (ACPI_SUCCESS(status))
134134
int34x_zone->aux_trip_nr = trip_cnt;
135135

136-
zone_trips = kzalloc(sizeof(*zone_trips) * (trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT),
137-
GFP_KERNEL);
136+
zone_trips = kcalloc(trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT,
137+
sizeof(*zone_trips), GFP_KERNEL);
138138
if (!zone_trips) {
139139
ret = -ENOMEM;
140140
goto err_trips_alloc;
@@ -143,7 +143,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
143143
for (i = 0; i < trip_cnt; i++) {
144144
zone_trips[i].type = THERMAL_TRIP_PASSIVE;
145145
zone_trips[i].temperature = THERMAL_TEMP_INVALID;
146-
zone_trips[i].flags |= THERMAL_TRIP_FLAG_RW_TEMP;
146+
zone_trips[i].flags = THERMAL_TRIP_FLAG_RW_TEMP;
147147
zone_trips[i].priv = THERMAL_INT_TO_TRIP_PRIV(i);
148148
}
149149

drivers/thermal/k3_j72xx_bandgap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,13 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
460460
goto err_alloc;
461461
}
462462

463-
ref_table = kzalloc(sizeof(*ref_table) * TABLE_SIZE, GFP_KERNEL);
463+
ref_table = kcalloc(TABLE_SIZE, sizeof(*ref_table), GFP_KERNEL);
464464
if (!ref_table) {
465465
ret = -ENOMEM;
466466
goto err_alloc;
467467
}
468468

469-
derived_table = devm_kzalloc(bgp->dev, sizeof(*derived_table) * TABLE_SIZE,
469+
derived_table = devm_kcalloc(bgp->dev, TABLE_SIZE, sizeof(*derived_table),
470470
GFP_KERNEL);
471471
if (!derived_table) {
472472
ret = -ENOMEM;

drivers/thermal/thermal_core.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,26 +1589,26 @@ thermal_zone_device_register_with_trips(const char *type,
15891589

15901590
tz->state = TZ_STATE_FLAG_INIT;
15911591

1592+
result = dev_set_name(&tz->device, "thermal_zone%d", tz->id);
1593+
if (result)
1594+
goto remove_id;
1595+
1596+
thermal_zone_device_init(tz);
1597+
1598+
result = thermal_zone_init_governor(tz);
1599+
if (result)
1600+
goto remove_id;
1601+
15921602
/* sys I/F */
15931603
/* Add nodes that are always present via .groups */
15941604
result = thermal_zone_create_device_groups(tz);
15951605
if (result)
15961606
goto remove_id;
15971607

1598-
result = dev_set_name(&tz->device, "thermal_zone%d", tz->id);
1599-
if (result) {
1600-
thermal_zone_destroy_device_groups(tz);
1601-
goto remove_id;
1602-
}
1603-
thermal_zone_device_init(tz);
16041608
result = device_register(&tz->device);
16051609
if (result)
16061610
goto release_device;
16071611

1608-
result = thermal_zone_init_governor(tz);
1609-
if (result)
1610-
goto unregister;
1611-
16121612
if (!tz->tzp || !tz->tzp->no_hwmon) {
16131613
result = thermal_add_hwmon_sysfs(tz);
16141614
if (result)

drivers/thermal/thermal_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static int cdev_tt_seq_show(struct seq_file *s, void *v)
319319
int i = *(loff_t *)v;
320320

321321
if (!i)
322-
seq_puts(s, "Transition\tOccurences\n");
322+
seq_puts(s, "Transition\tOccurrences\n");
323323

324324
list_for_each_entry(entry, &transitions[i], node) {
325325
/*
@@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device *tz)
876876

877877
tz_dbg->tz = tz;
878878

879-
tz_dbg->trips_crossed = kzalloc(sizeof(int) * tz->num_trips, GFP_KERNEL);
879+
tz_dbg->trips_crossed = kcalloc(tz->num_trips, sizeof(int), GFP_KERNEL);
880880
if (!tz_dbg->trips_crossed) {
881881
thermal_debugfs_remove_id(thermal_dbg);
882882
return;

drivers/thermal/thermal_of.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
107107
if (!count)
108108
return NULL;
109109

110-
struct thermal_trip *tt __free(kfree) = kzalloc(sizeof(*tt) * count, GFP_KERNEL);
110+
struct thermal_trip *tt __free(kfree) = kcalloc(count, sizeof(*tt), GFP_KERNEL);
111111
if (!tt)
112112
return ERR_PTR(-ENOMEM);
113113

0 commit comments

Comments
 (0)