diff mbox series

[V2] soc/tegra: pmc: Don't allocate struct tegra_powergate on stack

Message ID 9b50f005ec748528cda2dde4ce03e2f958fe288a.1525336111.git.viresh.kumar@linaro.org
State New
Headers show
Series [V2] soc/tegra: pmc: Don't allocate struct tegra_powergate on stack | expand

Commit Message

Viresh Kumar May 3, 2018, 8:32 a.m. UTC
With a later commit an instance of the struct device will be added to
struct genpd and with that the size of the struct tegra_powergate will
be over 1024 bytes. That generates following warning:

drivers/soc/tegra/pmc.c:579:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Avoid such warnings by allocating the structure dynamically.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
V2:
- Based of latest changes.
- Compile tested only.

@Jon: This was sent long back[1], but then the genpd series wasn't
finalized, which is going to get merged [2] very soon now. Can I have
your Ack for this patch so that I can apply it at the beginning of that
series ?

[1] https://lkml.kernel.org/r/3fe40fcd427e49cbeac31e14721fea569d230b6e.1490073884.git.viresh.kumar@linaro.org
[2] https://lkml.kernel.org/r/cover.1523273291.git.viresh.kumar@linaro.org

 drivers/soc/tegra/pmc.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

-- 
2.15.0.194.g9af6a3dea062

Comments

Thierry Reding May 3, 2018, 9:38 a.m. UTC | #1
On Thu, May 03, 2018 at 02:02:48PM +0530, Viresh Kumar wrote:
> With a later commit an instance of the struct device will be added to

> struct genpd and with that the size of the struct tegra_powergate will

> be over 1024 bytes. That generates following warning:

> 

> drivers/soc/tegra/pmc.c:579:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=]

> 

> Avoid such warnings by allocating the structure dynamically.

> 

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> ---

> V2:

> - Based of latest changes.

> - Compile tested only.

> 

> @Jon: This was sent long back[1], but then the genpd series wasn't

> finalized, which is going to get merged [2] very soon now. Can I have

> your Ack for this patch so that I can apply it at the beginning of that

> series ?

> 

> [1] https://lkml.kernel.org/r/3fe40fcd427e49cbeac31e14721fea569d230b6e.1490073884.git.viresh.kumar@linaro.org

> [2] https://lkml.kernel.org/r/cover.1523273291.git.viresh.kumar@linaro.org

> 

>  drivers/soc/tegra/pmc.c | 20 +++++++++++++-------

>  1 file changed, 13 insertions(+), 7 deletions(-)


Acked-by: Thierry Reding <treding@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index d9fcdb592b39..3e3d12ce4587 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -559,22 +559,28 @@  EXPORT_SYMBOL(tegra_powergate_remove_clamping);
 int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
 				      struct reset_control *rst)
 {
-	struct tegra_powergate pg;
+	struct tegra_powergate *pg;
 	int err;
 
 	if (!tegra_powergate_is_available(id))
 		return -EINVAL;
 
-	pg.id = id;
-	pg.clks = &clk;
-	pg.num_clks = 1;
-	pg.reset = rst;
-	pg.pmc = pmc;
+	pg = kzalloc(sizeof(*pg), GFP_KERNEL);
+	if (!pg)
+		return -ENOMEM;
 
-	err = tegra_powergate_power_up(&pg, false);
+	pg->id = id;
+	pg->clks = &clk;
+	pg->num_clks = 1;
+	pg->reset = rst;
+	pg->pmc = pmc;
+
+	err = tegra_powergate_power_up(pg, false);
 	if (err)
 		pr_err("failed to turn on partition %d: %d\n", id, err);
 
+	kfree(pg);
+
 	return err;
 }
 EXPORT_SYMBOL(tegra_powergate_sequence_power_up);