summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@tuxon.dev>2024-07-14 17:13:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-04 16:29:30 +0200
commit08d13bcb9cea2b9ceb00b956681cac682241db60 (patch)
treeb6bd8c44c15193d4eedaf6009f7c27a5edd72058 /drivers/clk
parentb6edb3fd96bf0579451e8b0bc5d19940bfa81df0 (diff)
downloadlinux-08d13bcb9cea2b9ceb00b956681cac682241db60.tar.gz
linux-08d13bcb9cea2b9ceb00b956681cac682241db60.tar.bz2
linux-08d13bcb9cea2b9ceb00b956681cac682241db60.zip
clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
[ Upstream commit 2d6e9ee7cb3e79b1713783c633b13af9aeffc90c ] 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: cb783bbbcf54 ("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>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/at91/sama7g5.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 91b5c6f14819..4e9594714b14 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -66,6 +66,7 @@ enum pll_component_id {
PLL_COMPID_FRAC,
PLL_COMPID_DIV0,
PLL_COMPID_DIV1,
+ PLL_COMPID_MAX,
};
/*
@@ -165,7 +166,7 @@ static struct sama7g5_pll {
u8 t;
u8 eid;
u8 safe_div;
-} sama7g5_plls[][PLL_ID_MAX] = {
+} sama7g5_plls[][PLL_COMPID_MAX] = {
[PLL_ID_CPU] = {
[PLL_COMPID_FRAC] = {
.n = "cpupll_fracck",
@@ -1038,7 +1039,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
sama7g5_pmc->chws[PMC_MAIN] = hw;
for (i = 0; i < PLL_ID_MAX; i++) {
- for (j = 0; j < 3; j++) {
+ for (j = 0; j < PLL_COMPID_MAX; j++) {
struct clk_hw *parent_hw;
if (!sama7g5_plls[i][j].n)