Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'thermal-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
"These include one thermal core fix for an issue leading to a NULL
pointer dereference, a similar fix for the int340x thermal driver
(even though the issue may not actually occur in practice in this
particular case), and a bunch of cleanups, mostly related to replacing
kzalloc() with kcalloc() where applicable.

Summary:

- Delay exposing thermal zone sysfs interface to prevent user space
from accessing thermal zones that have not been completely
initialized yet (Lucas De Marchi)

- Check a pointer against NULL early in int3402_thermal_probe() to
avoid a potential NULL pointer dereference (Chenyuan Yang)

- Use kcalloc() instead of kzalloc() in some places in the thermal
control subsystem (Lukasz Luba, Ethan Carter Edwards)

- Fix a spelling mistake in a comment in the thermal core (Colin Ian
King)

- Clean up variable initialization in int340x_thermal_zone_add()
(Christophe JAILLET)"

* tag 'thermal-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: int340x: Add NULL check for adev
thermal: core: Delay exposing sysfs interface
thermal: core: Fix spelling mistake "Occurences" -> "Occurrences"
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()

+23 -20
+2 -2
drivers/thermal/hisi_thermal.c
··· 412 412 413 413 data->nr_sensors = 1; 414 414 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); 417 417 if (!data->sensor) 418 418 return -ENOMEM; 419 419
+3
drivers/thermal/intel/int340x_thermal/int3402_thermal.c
··· 45 45 struct int3402_thermal_data *d; 46 46 int ret; 47 47 48 + if (!adev) 49 + return -ENODEV; 50 + 48 51 if (!acpi_has_method(adev->handle, "_TMP")) 49 52 return -ENODEV; 50 53
+3 -3
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
··· 133 133 if (ACPI_SUCCESS(status)) 134 134 int34x_zone->aux_trip_nr = trip_cnt; 135 135 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); 138 138 if (!zone_trips) { 139 139 ret = -ENOMEM; 140 140 goto err_trips_alloc; ··· 143 143 for (i = 0; i < trip_cnt; i++) { 144 144 zone_trips[i].type = THERMAL_TRIP_PASSIVE; 145 145 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; 147 147 zone_trips[i].priv = THERMAL_INT_TO_TRIP_PRIV(i); 148 148 } 149 149
+2 -2
drivers/thermal/k3_j72xx_bandgap.c
··· 460 460 goto err_alloc; 461 461 } 462 462 463 - ref_table = kzalloc(sizeof(*ref_table) * TABLE_SIZE, GFP_KERNEL); 463 + ref_table = kcalloc(TABLE_SIZE, sizeof(*ref_table), GFP_KERNEL); 464 464 if (!ref_table) { 465 465 ret = -ENOMEM; 466 466 goto err_alloc; 467 467 } 468 468 469 - derived_table = devm_kzalloc(bgp->dev, sizeof(*derived_table) * TABLE_SIZE, 469 + derived_table = devm_kcalloc(bgp->dev, TABLE_SIZE, sizeof(*derived_table), 470 470 GFP_KERNEL); 471 471 if (!derived_table) { 472 472 ret = -ENOMEM;
+10 -10
drivers/thermal/thermal_core.c
··· 1589 1589 1590 1590 tz->state = TZ_STATE_FLAG_INIT; 1591 1591 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 + 1592 1602 /* sys I/F */ 1593 1603 /* Add nodes that are always present via .groups */ 1594 1604 result = thermal_zone_create_device_groups(tz); 1595 1605 if (result) 1596 1606 goto remove_id; 1597 1607 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); 1604 1608 result = device_register(&tz->device); 1605 1609 if (result) 1606 1610 goto release_device; 1607 - 1608 - result = thermal_zone_init_governor(tz); 1609 - if (result) 1610 - goto unregister; 1611 1611 1612 1612 if (!tz->tzp || !tz->tzp->no_hwmon) { 1613 1613 result = thermal_add_hwmon_sysfs(tz);
+2 -2
drivers/thermal/thermal_debugfs.c
··· 319 319 int i = *(loff_t *)v; 320 320 321 321 if (!i) 322 - seq_puts(s, "Transition\tOccurences\n"); 322 + seq_puts(s, "Transition\tOccurrences\n"); 323 323 324 324 list_for_each_entry(entry, &transitions[i], node) { 325 325 /* ··· 876 876 877 877 tz_dbg->tz = tz; 878 878 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); 880 880 if (!tz_dbg->trips_crossed) { 881 881 thermal_debugfs_remove_id(thermal_dbg); 882 882 return;
+1 -1
drivers/thermal/thermal_of.c
··· 107 107 if (!count) 108 108 return NULL; 109 109 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); 111 111 if (!tt) 112 112 return ERR_PTR(-ENOMEM); 113 113