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 <dlechner@baylibre.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user