diff options
author | Uwe Kleine-König <[email protected]> | 2020-12-15 10:20:30 +0100 |
---|---|---|
committer | Guenter Roeck <[email protected]> | 2020-12-30 08:21:04 -0800 |
commit | 1eda52334e6d13eb1a85f713ce06dd39342b5020 (patch) | |
tree | 0fa3f0d27a960dc576165a63797b564731333737 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | e042f151ec7474b88b8c1edaaddd1ff7415d7117 (diff) |
hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values
With MAX_PWM being defined to 255 the code
unsigned long period;
...
period = ctx->pwm->args.period;
state.duty_cycle = DIV_ROUND_UP(pwm * (period - 1), MAX_PWM);
calculates a too small value for duty_cycle if the configured period is
big (either by discarding the 64 bit value ctx->pwm->args.period or by
overflowing the multiplication). As this results in a too slow fan and
so maybe an overheating machine better be safe than sorry and error out
in .probe.
Signed-off-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions