]> exis.tech > repos - linux.git/commit
clk: mediatek: mt7988: use MUX_CLR_SET for gate-less muxes
authorDaniel Golle <daniel@makrotopia.org>
Thu, 26 Mar 2026 05:11:12 +0000 (05:11 +0000)
committerStephen Boyd <sboyd@kernel.org>
Wed, 29 Apr 2026 02:05:45 +0000 (19:05 -0700)
commit845a025a9436d40517b8fab0baea2d6157e0a552
tree71ce7263b6842fd55a7e6d1b7eb804365af7d9b2
parentaec2d3caae24216a8cd530aff7bc7528bd1531b2
clk: mediatek: mt7988: use MUX_CLR_SET for gate-less muxes

All 19 muxes in the infra_muxes[] array are pure mux selectors without
a clock gate or update register, yet they were defined using
MUX_GATE_CLR_SET_UPD with gate_shift = -1.

This macro assigns mtk_mux_gate_clr_set_upd_ops, whose
enable/disable/is_enabled callbacks perform BIT(gate_shift). Since
gate_shift is stored as u8, the -1 truncates to 255, causing a
shift-out-of-bounds at runtime:

UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:76:8
shift exponent 255 is too large for 64-bit type 'long unsigned int'

UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:102:4
shift exponent 255 is too large for 64-bit type 'long unsigned int'

UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:122:16
shift exponent 255 is too large for 64-bit type 'long unsigned int'

Switch these definitions to MUX_CLR_SET, which uses
mtk_mux_clr_set_upd_ops (no gate callbacks) and does not require
callers to pass sentinel values for unused update register fields.
The actual clock gating for these peripherals is handled by the
separate GATE_INFRA* definitions further down.

Fixes: 4b4719437d85f ("clk: mediatek: add drivers for MT7988 SoC")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mt7988-infracfg.c