From patchwork Sun Jul 14 14:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13732722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B7B1C3DA42 for ; Sun, 14 Jul 2024 14:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=OPemvKQipXI8Fajmb4L1Z0OCxTylC6aJHx822c7eIuw=; b=dJKuYeUGznmTfiwEM0G+/okCN7 aMwlYFdk6NNv+IkBSJiJI2iNU6O5heDaPh/vUGu7f8LSi8y8cKJcQpPL46qJ8GiKrLcOkzJxpcDQn FOxg/JvOJUvW8XW6U7mIJ6P8TNSNZ7PLX/zBiEDD2UlCZpqY0walIvubUZR0nZAHanwLq5Fkma0YG 4MdapbkCYTegyyIoU7eOEA4HUh4K6tMuW2ay0MCk8iqtBpRULUfhKpZB/oxXn1R9QDC5vSNAi9wUb uXzvThHYrpKzRIJQQCfPH4GnAnSfPwGRyJigZe2fYR9gR+lO00EhJ7alvRn1Pu6NCMLmbU2KI5T29 Teh129ug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSzyt-00000004azy-1neD; Sun, 14 Jul 2024 14:13:39 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSzya-00000004awv-1cHv for linux-arm-kernel@lists.infradead.org; Sun, 14 Jul 2024 14:13:22 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ec61eeed8eso45691211fa.0 for ; Sun, 14 Jul 2024 07:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1720966398; x=1721571198; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OPemvKQipXI8Fajmb4L1Z0OCxTylC6aJHx822c7eIuw=; b=boPNfRvImQLEP8cJ1euXKBBESXtMHvYlrdFvdN1x7RqNcz1fUtI4JlFTVSkAklEtmJ qyCBp6MN5rh4lGFeb8tiZaObQklrxZSmMhrN0ZcdbaqDSrzAgLvI+mt19EB/526xPl4r 3CkESRMqvAHCsbbAvIAg0Su7VMOxpgIsfu0mZ2Bt42oU69n+TKdn03D4HfEET0KY5N2v n3putZpwQ2LK/wcITy/Fqf2Yt7LXlan2pURuPNSh1tZTrGWD6ghaYboqgZwEJm8Evnry DTEM4tp8AS/A1o6/5rho9o6oL0z2NlanfLCj8CKIghQzknqggFb3XoX6489bv96N7e7v 8icw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720966398; x=1721571198; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OPemvKQipXI8Fajmb4L1Z0OCxTylC6aJHx822c7eIuw=; b=Mb/VrLwJiNbSPm3UJpqKguNwUDs3f7JAyS0F9H6rrsHaF6YQcySjzMFDKlIYJMXa6c ZrFPQdkBNwh20WfT3+/JkMhC5LFpoJMAJBgKAerfDAeVNdNGSe7mnnuZzuk91B1KdXQs ssuLUVOkU27nVArNY0CYT61KqOK7gKNqO3QFWv7r90VjkN/6F005TzdjA9yMATgKnORe DNtG9OTkFXWuh123dyMyenIrKe3GO7LywLze5hs5x8UldkVxq9eYJEXCNDPfBLLwiS9X hKZPCBeNdLpIeCrEVyTE72eY4KhXqAS+LxQNSH2Haq1CUwjoz9Z6USujrjcpFBaWUCY1 te9Q== X-Forwarded-Encrypted: i=1; AJvYcCU/GlrUofYKIkKOjTnwnC322dF+MCv4yPVekuyjh4Gy+ygFcw7/lSLXH39uevNs+oB88vKoF4I5brCi6cuYntEf+yttOsWEbiLpkMRlCMrOp8bGuvE= X-Gm-Message-State: AOJu0Yzd2jblO+OpgnncR0j0wqtYJ5+90vtEQum8erj5M6QYpteuusgJ pxwZCzfT7o/9Hl4yAb8mfb2DOdpyO2yS78FQbHWi8oZ2R8MU+PYTU+a4TSORd/vY2fkIett8fxa 6 X-Google-Smtp-Source: AGHT+IGEDrDG8yo3MRE7jueSV+peLkjS+0MPg0DVEhfwYtsZaoBIL5p+ZRxyUu9Q/15yJv9uMT+brQ== X-Received: by 2002:a05:6512:3e28:b0:52e:9b4f:cfdc with SMTP id 2adb3069b0e04-52eb9994387mr11409767e87.26.1720966398433; Sun, 14 Jul 2024 07:13:18 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.171]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f259761sm86533755e9.11.2024.07.14.07.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 07:13:18 -0700 (PDT) From: Claudiu Beznea To: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH] clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs Date: Sun, 14 Jul 2024 17:13:15 +0300 Message-Id: <20240714141315.19480-1-claudiu.beznea@tuxon.dev> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240714_071320_449982_A1A4F3CE X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Claudiu Beznea Acked-by: Stephen Boyd --- drivers/clk/at91/sama7g5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 6706d1305baa..8385badc1c70 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -51,6 +51,7 @@ enum pll_component_id { PLL_COMPID_FRAC, PLL_COMPID_DIV0, PLL_COMPID_DIV1, + PLL_COMPID_MAX, }; /* @@ -157,7 +158,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", @@ -1030,7 +1031,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)