diff options
| author | Cunhao Lu <1579567540@qq.com> | 2026-10-23 16:21:05 +0800 |
|---|---|---|
| committer | Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> | 2026-10-28 10:25:45 +0100 |
| commit | 13467fd6998f5da4f5b4f172f1af3d9c48d5de8f (patch) | |
| tree | 4d5ccc4174e73699f4126d7ad29e98159742eab9 /rust/kernel/alloc/allocator | |
| parent | dae739137441667d67fbfcc4d303a0ecc6618662 (diff) | |
gpio: rockchip: Fix debounce arithmetic for GPIO v2
The debounce interval calculations use unsigned long operands. On 32-bit
systems, the numerator used to calculate the maximum interval overflows
before division, while multiplying the requested interval by the clock
rate overflows before it is assigned to a u64. A zero debounce clock rate
also causes division by zero.
Use 64-bit arithmetic for both calculations and reject a zero clock rate
before division.
At 32768 Hz, a 1 us request rounds to zero divider periods. Subtracting
one then wraps the divider value to ULONG_MAX. Decrement only a nonzero
rounded period count so that such requests use the smallest divider
value.
Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller")
Cc: stable@vger.kernel.org
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/20261023-fix-rockchip-gpio-v2-debounce-v1-1-f1141bd5b58f@qq.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
