diff options
| author | Junhui Liu <junhui.liu@pigmoral.tech> | 2026-05-14 17:27:17 +0800 |
|---|---|---|
| committer | Brian Masney <bmasney@redhat.com> | 2026-09-29 14:12:34 -0400 |
| commit | f036decc4434323b47b58ad9508fe27d8c9087c2 (patch) | |
| tree | a325294ede1b8368f0f44d28e645097413ea4534 /include/linux/timerqueue.h | |
| parent | b6685c30d15cd7f28c40b2daaeacc00f21b2f12a (diff) | |
clk: correct clk_div_mask() return value for width == 32
The macro clk_div_mask() currently wraps to zero when width is 32 due to
1 << 32 being undefined behavior. This leads to incorrect mask generation
and prevents correct retrieval of register field values for 32-bit-wide
dividers.
Although it is unlikely to exhaust all U32_MAX div, some clock IPs may rely
on a 32-bit val entry in their div_table to match a div, so providing a
full 32-bit mask is necessary.
Fix this by using the standard GENMASK() macro. This safely resolves the
undefined behavior on both 32-bit and 64-bit architectures, while also
benefiting from the built-in compile-time type and bounds checking
provided by the GENMASK() macro.
Cc: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Cc: Brian Masney <bmasney@redhat.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
