From patchwork Thu May 3 08:32:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 907888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="E5wwSCkW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40c7gr1Dx1z9s3Z for ; Thu, 3 May 2018 18:32:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751128AbeECIcy (ORCPT ); Thu, 3 May 2018 04:32:54 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:46977 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbeECIcx (ORCPT ); Thu, 3 May 2018 04:32:53 -0400 Received: by mail-pg0-f67.google.com with SMTP id z4-v6so12594984pgu.13 for ; Thu, 03 May 2018 01:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ESOcQ9cfaoHScIdRFoE9W9/JBLle7jtN2XGLxWwFN8k=; b=E5wwSCkWn0woIeR2PIJnTBF/3dgL8dNmAM+RnQLRrguKJPFSNRGYdDG43vsn+nDDR+ gMluZzGN4Nrr4uSWmUUm+L+TZAmkmX5UpC5PnzeH+g/jtMDpyVfKzKS4PWJn1htxilJR gh8LxXoxpnvqJ4RZobAJ/KMvqVyoUzK8flj/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ESOcQ9cfaoHScIdRFoE9W9/JBLle7jtN2XGLxWwFN8k=; b=qH11nY0e2jKzU0eh0HtVQ07qgvthQCaT//xfhgk5rc19VNoCHkz3vNFmpfGekXCHJa ux/pCnbmeq8Bv4T+FMSKf5Y8q6lVOoFqDwJtiiAu/k0eWWDl5YVaRy6w6l1M4Xo5ke80 Ux1BxF5kYwdUX/WlzF9B4A10KopZGapDikFhvZ1h6DsTFHHB70XmsNXOPV0X8qQvj3Sp BjBePw5RL3iJJfPdpJJ3/L/mqmRFSJLc0fDBzvjIaPOsRlyLHjq35a4Wrhdd/b8brZP3 qyoGOZ1kl627gKLik4yeZNyfR+sEjCXZsvkG5Q3P/tztIYwQYg98x8hh+4meU8Zl0LNu A76Q== X-Gm-Message-State: ALQs6tDcN4GSmP9+TY99VvewvE0r2p1MBRbFiSTc29GZC2QFFe8g/5jV XITYaJh1Unx9bNfdqedXY7Kfbg== X-Google-Smtp-Source: AB8JxZqwjebIiB4IgYLM2RA8xjCNkChCq0F7IHZ1fZx5uBfyyoY5tn11fxfamKrA8OdqIfgL/opG5Q== X-Received: by 2002:a65:4244:: with SMTP id d4-v6mr18416974pgq.234.1525336372366; Thu, 03 May 2018 01:32:52 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id s20-v6sm20420981pgv.14.2018.05.03.01.32.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 01:32:51 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , rnayak@codeaurora.org, linux-tegra@vger.kernel.org Subject: [PATCH V2] soc/tegra: pmc: Don't allocate struct tegra_powergate on stack Date: Thu, 3 May 2018 14:02:48 +0530 Message-Id: <9b50f005ec748528cda2dde4ce03e2f958fe288a.1525336111.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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 Acked-by: Thierry Reding --- 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(-) 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);