Skip to content

Commit 0dc9a71

Browse files
Jiangshan Yirafaeljw
authored andcommitted
ACPI: thermal: Replace ternary operator with min_t()
Modify the code in accordance with the coccicheck warning: drivers/acpi/thermal.c:422: WARNING opportunity for min(). min_t() macro is defined in include/linux/minmax.h. It avoids multiple evaluations of the arguments when non-constant and performs strict type-checking. Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 197b6b6 commit 0dc9a71

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/acpi/thermal.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
419419
* the next higher trip point
420420
*/
421421
tz->trips.active[i-1].temperature =
422-
(tz->trips.active[i-2].temperature <
423-
celsius_to_deci_kelvin(act) ?
424-
tz->trips.active[i-2].temperature :
425-
celsius_to_deci_kelvin(act));
422+
min_t(unsigned long,
423+
tz->trips.active[i-2].temperature,
424+
celsius_to_deci_kelvin(act));
426425

427426
break;
428427
} else {

0 commit comments

Comments
 (0)