Skip to content

Commit 2d6e9ee

Browse files
committed
clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Claudiu Beznea <[email protected]>
1 parent 33013b4 commit 2d6e9ee

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
@@ -51,6 +51,7 @@ enum pll_component_id {
5151
PLL_COMPID_FRAC,
5252
PLL_COMPID_DIV0,
5353
PLL_COMPID_DIV1,
54+
PLL_COMPID_MAX,
5455
};
5556

5657
/*
@@ -157,7 +158,7 @@ static struct sama7g5_pll {
157158
u8 t;
158159
u8 eid;
159160
u8 safe_div;
160-
} sama7g5_plls[][PLL_ID_MAX] = {
161+
} sama7g5_plls[][PLL_COMPID_MAX] = {
161162
[PLL_ID_CPU] = {
162163
[PLL_COMPID_FRAC] = {
163164
.n = "cpupll_fracck",
@@ -1030,7 +1031,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
10301031
sama7g5_pmc->chws[PMC_MAIN] = hw;
10311032

10321033
for (i = 0; i < PLL_ID_MAX; i++) {
1033-
for (j = 0; j < 3; j++) {
1034+
for (j = 0; j < PLL_COMPID_MAX; j++) {
10341035
struct clk_hw *parent_hw;
10351036

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

0 commit comments

Comments
 (0)