Skip to content

Commit 08d13bc

Browse files
claudiubezneagregkh
authored andcommitted
clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
[ Upstream commit 2d6e9ee ] The maximum number of PLL components on SAMA7G5 is 3 (one fractional part and 2 dividers). Allocate the needed amount of memory for sama7g5_plls 2d array. Previous code used to allocate 7 array entries for each PLL. While at it, replace 3 with PLL_COMPID_MAX in the loop which parses the sama7g5_plls 2d array. Fixes: cb783bb ("clk: at91: sama7g5: add clock support for sama7g5") Acked-by: Stephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20240714141315.19480-1-claudiu.beznea@tuxon.dev Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b6edb3f commit 08d13bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/clk/at91/sama7g5.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum pll_component_id {
6666
PLL_COMPID_FRAC,
6767
PLL_COMPID_DIV0,
6868
PLL_COMPID_DIV1,
69+
PLL_COMPID_MAX,
6970
};
7071

7172
/*
@@ -165,7 +166,7 @@ static struct sama7g5_pll {
165166
u8 t;
166167
u8 eid;
167168
u8 safe_div;
168-
} sama7g5_plls[][PLL_ID_MAX] = {
169+
} sama7g5_plls[][PLL_COMPID_MAX] = {
169170
[PLL_ID_CPU] = {
170171
[PLL_COMPID_FRAC] = {
171172
.n = "cpupll_fracck",
@@ -1038,7 +1039,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
10381039
sama7g5_pmc->chws[PMC_MAIN] = hw;
10391040

10401041
for (i = 0; i < PLL_ID_MAX; i++) {
1041-
for (j = 0; j < 3; j++) {
1042+
for (j = 0; j < PLL_COMPID_MAX; j++) {
10421043
struct clk_hw *parent_hw;
10431044

10441045
if (!sama7g5_plls[i][j].n)

0 commit comments

Comments
 (0)