From patchwork Wed Jan 25 22:20:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9538033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 012626042B for ; Wed, 25 Jan 2017 22:21:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2F002094F for ; Wed, 25 Jan 2017 22:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6A0727F07; Wed, 25 Jan 2017 22:21:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 796A92094F for ; Wed, 25 Jan 2017 22:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881AbdAYWVq (ORCPT ); Wed, 25 Jan 2017 17:21:46 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:55282 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbdAYWVp (ORCPT ); Wed, 25 Jan 2017 17:21:45 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0Mhgu7-1cssQ62PKd-00MtV3; Wed, 25 Jan 2017 23:21:29 +0100 From: Arnd Bergmann To: Mark Brown Cc: Arnd Bergmann , Sangbeom Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Liam Girdwood , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] regulator: s2mpa01: reduce stack size for probe function Date: Wed, 25 Jan 2017 23:20:59 +0100 Message-Id: <20170125222126.1188246-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:BasmabkRoQFQ0jw7JA753nwF6ZiDQ5ENfrmig9/fIeLetITs+Ht B79dKNt1PfZ4yTTpUsrwYoqMg5354iG/YVuy+bWoo7Rqj6F0gyi0ig4Oo8bzi4YbehlGI5l wSXdrHQf46fLfE2Fx8NNJMOhnrYJzyFj07Ab6CBAiRgOVPerQn8RsAEFWpLxqSPZ2mUdBKq GefwrIcoWcRReJSFttSDQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:nSjB3/0DGoE=:tEgvn8qtA4eLbE478s9lsE bzk3C+0SmsfkVqWT+qifwM39oE3DTBwVXPmuv/+XdI6loZCoXmTbr1Ogv/sB+rTzd+PoX9M0p W3Muzf4bUodrYkE7dAdqGhXDSYDPbQ8VKK1zXkR8QRMquZ1OFCZgMET/JNWGpMTeulTZ9yAIi 8DpPNMyjH5AZ+q6/W5g2wm8tjG5Fu2wSiFWxB61+od3cr0XgsD+O1NHgZSKAK4XSDcKTqfUHR 095AuHHqHI+PDcfp60//N5YzuM1j8YenxyZ4ee+jZMFN1JOwdz/O9m/lor1PAoDDwfiD7QDex Nh4WSq//zqRxRjXcDkEs2BmkVVKEf9UW2bsgJrdFTK0gWUDIK2RUKs+tgOUtKnFgePAdINfqL zGBrRzIft+fwJ3jRylZm58oboDKvXPW1PePNtQgyB4KmXJmBjBzcTJOEwZ45XwY084s99YrKV 4s3G9ueFLIvlxmIA60akFhL7r2vNuwQ+wZUA5a/OytD2nKX6EAqF0gfn0+h3NeyEf+U02umO+ NnLgW1dImE9+1gA406xt1F5b0G6w9yhR46NRkSU44MJLBeNXk7aX9fmPEM8+puAbaPjPd5HcK JVpK6QFIO6Eb18W+2+ku53lPHLv23ylJOG1i/p8ziMbTU39XQ2Y6QNaD67QbEz5DyAna1CPa6 zC757oZmHFBWcYIKxlZaGYxGftFW7ug5w1ERTCyCQIZWP1OlNhMmiNpPU1AozB5DTiew= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In some rare configurations we can run into rather high kernel stack consumption: drivers/regulator/s2mpa01.c:397:1: error: the frame size of 1536 bytes is larger than 1152 bytes [-Werror=frame-larger-than=] This is probably harmless since it happens only in the probe function, but there is also a relatively simple workaround, moving the regulator match data into the device specific structure. As a small downside, we waste a little memory at runtime. An alternative approach would free the array at the end of the probe function, which in turn is a little more complicated. Fixes: f18792714608 ("regulator: Add support for S2MPA01 regulator") Signed-off-by: Arnd Bergmann --- drivers/regulator/s2mpa01.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 92f88753bfed..38ee97a085f9 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c @@ -26,6 +26,7 @@ #define S2MPA01_REGULATOR_CNT ARRAY_SIZE(regulators) struct s2mpa01_info { + struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; int ramp_delay24; int ramp_delay3; int ramp_delay5; @@ -341,9 +342,9 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); - struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX] = { }; struct device_node *reg_np = NULL; struct regulator_config config = { }; + struct of_regulator_match *rdata; struct s2mpa01_info *s2mpa01; int i; @@ -351,6 +352,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) if (!s2mpa01) return -ENOMEM; + rdata = s2mpa01->rdata; for (i = 0; i < S2MPA01_REGULATOR_CNT; i++) rdata[i].name = regulators[i].name;