From patchwork Fri May 13 11:31:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 9090701 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B4D5BF29F for ; Fri, 13 May 2016 11:32:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8C2E2024D for ; Fri, 13 May 2016 11:32:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD84A2022D for ; Fri, 13 May 2016 11:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752196AbcEMLcY (ORCPT ); Fri, 13 May 2016 07:32:24 -0400 Received: from e28smtp04.in.ibm.com ([125.16.236.4]:39742 "EHLO e28smtp04.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbcEMLcX (ORCPT ); Fri, 13 May 2016 07:32:23 -0400 Received: from localhost by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 May 2016 17:02:14 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 13 May 2016 17:02:10 +0530 X-IBM-Helo: d28dlp03.in.ibm.com X-IBM-MailFrom: gwshan@linux.vnet.ibm.com X-IBM-RcptTo: devicetree@vger.kernel.org;linux-pci@vger.kernel.org Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 9C2161258065; Fri, 13 May 2016 17:04:18 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay02.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u4DBWHaH3015010; Fri, 13 May 2016 17:02:17 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u4DBW0vP012536; Fri, 13 May 2016 17:02:07 +0530 Received: from gwshan ([9.192.181.167]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id u4DBVnSk011954; Fri, 13 May 2016 17:01:51 +0530 Received: by gwshan (Postfix, from userid 1000) id 77D0B941D98; Fri, 13 May 2016 21:31:40 +1000 (AEST) From: Gavin Shan To: devicetree@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, geert@linux-m68k.org, robherring2@gmail.com, benh@kernel.crashing.org, mpe@ellerman.id.au, aik@ozlabs.ru, bhelgaas@google.com, grant.likely@linaro.org, panto@antoniou-consulting.com, frowand.list@gmail.com, Gavin Shan Subject: [PATCH] drivers/of: Fix build warning in populate_node() Date: Fri, 13 May 2016 21:31:39 +1000 Message-Id: <1463139099-23363-1-git-send-email-gwshan@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16051311-0013-0000-0000-00000C7A0AF1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Function populate_node() is used to unflatten FDT blob to device tree. It supports maximal 64 level of device nodes. There is one array @fpsizes[64] tracking the full name length of last unflattened device node in the corresponding level (index of element in the array - 1). Build warning is seen with CONFIG_FRAME_WARN=1024 like below on ARM64 as Geert reported. The issue can be reproduced on PPC64 as well. $ make drivers/of/fdt.o drivers/of/fdt.c:443:1: warning: the frame size of 1136 bytes is \ larger than 1024 bytes [-Wframe-larger-than=] This changes the data type of @fpsizes[i] from "unsigned long" to "unsigned int" to avoid the build warning. The return value type of populate_node() and its @fpsize argument is adjusted accordingly. With this applied, 256 bytes saved from the stack frame on ARM64 and PPC64 platforms and the above warning isn't seen. Fixes: 9ffa9eb ("drivers/of: Avoid recursively calling unflatten_dt_node()") Reported-by: Geert Uytterhoeven Signed-off-by: Gavin Shan --- drivers/of/fdt.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c95054c..34344a8 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -264,13 +264,13 @@ static void populate_properties(const void *blob, *pprev = NULL; } -static unsigned long populate_node(const void *blob, - int offset, - void **mem, - struct device_node *dad, - unsigned long fpsize, - struct device_node **pnp, - bool dryrun) +static unsigned int populate_node(const void *blob, + int offset, + void **mem, + struct device_node *dad, + unsigned int fpsize, + struct device_node **pnp, + bool dryrun) { struct device_node *np; const char *pathp; @@ -397,7 +397,7 @@ static int unflatten_dt_nodes(const void *blob, struct device_node *root; int offset = 0, depth = 0; #define FDT_MAX_DEPTH 64 - unsigned long fpsizes[FDT_MAX_DEPTH]; + unsigned int fpsizes[FDT_MAX_DEPTH]; struct device_node *nps[FDT_MAX_DEPTH]; void *base = mem; bool dryrun = !base;