From: David Lechner Date: Wed, 7 Jan 2026 15:50:17 +0000 (-0600) Subject: clk: mediatek: mt7623: set unmapped IDs to -1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb2bf2bc832d34440204ad90795ca7475ede4402;p=thirdparty%2Fu-boot.git clk: mediatek: mt7623: set unmapped IDs to -1 Add range initializers to the id_offs_map arrays in the mt7623 clk driver to set unmapped IDs to -1. This prevents accidental usage of unmapped IDs that would otherwise map to 0. mtk_common_clk_of_xlate() checks these values for < 0 and returns -ENOENT in that case. A range initializer covering the entire array is used since it is less error-prone than manually looking up the value of each macro in the existing initializers and checking for gaps. It is placed first so that the specific initializers override it. Signed-off-by: David Lechner --- diff --git a/drivers/clk/mediatek/clk-mt7623.c b/drivers/clk/mediatek/clk-mt7623.c index eca8352d8e6..6ce1d729736 100644 --- a/drivers/clk/mediatek/clk-mt7623.c +++ b/drivers/clk/mediatek/clk-mt7623.c @@ -26,6 +26,7 @@ /* apmixedsys */ static const int pll_id_offs_map[] = { + [0 ... CLK_APMIXED_NR - 1] = -1, [CLK_APMIXED_ARMPLL] = 0, [CLK_APMIXED_MAINPLL] = 1, [CLK_APMIXED_UNIVPLL] = 2, @@ -92,6 +93,7 @@ static const struct mtk_pll_data apmixed_plls[] = { #define CLK_TOP_HDMITX_CLKDIG_CTS CLK_TOP_NR static const int top_id_offs_map[CLK_TOP_NR + 1] = { + [0 ... CLK_TOP_NR] = -1, /* Fixed CLK */ [CLK_TOP_DPI] = 0, [CLK_TOP_DMPLL] = 1, @@ -808,6 +810,7 @@ static const struct mtk_gate infra_cgs[] = { /* pericfg */ static const int peri_id_offs_map[] = { + [0 ... CLK_PERI_NR - 1] = -1, /* MUX CLK */ [CLK_PERI_UART0_SEL] = 1, [CLK_PERI_UART1_SEL] = 2,