Received: by 10.223.185.116 with SMTP id b49csp4648206wrg; Mon, 26 Feb 2018 23:34:33 -0800 (PST) X-Google-Smtp-Source: AH8x224fpq7Wh4+c0MFBl/HWItNBrjPKQJRTtnDIW9MAwhL7wmGX3d9OPz3NEodfIyNPxoXeyi3r X-Received: by 10.99.117.6 with SMTP id q6mr10537694pgc.146.1519716873219; Mon, 26 Feb 2018 23:34:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519716873; cv=none; d=google.com; s=arc-20160816; b=Hj2o3spVsu6PAX86eroFBOGNQHomD36xqOrbWPkXfHh50+ACwwZ9j+U1MsqHksTJcE Nc2Thl5qFW6TI0LaPk+cZ0P1+ljEe/w8zXefy8vsPJPcFrc05pf8WaHgqlUpY0/Efww/ 5ja+fqF6F+iYMxr7o9LNzbySQHGBgCia0oDZX+76cIQuaugIodBvYau2uGHcsy6jVXX7 g5/RhBlIZK0SuQzRAZwP+jHbiJc03lTJfBVy0GZNTAGn5GdyTeunx6UYkIzCd6JDotHX set6ul/a1H7CgqkecQVSfDEcvCww69JqXGD/sVqRoHDNqNe2yIDUDRPnDXIXVG2w5oAS WOBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=lw/wZoktVJTuKk5RXZTlHsLF/HpTbw52sa+aBx0OiKs=; b=PUhwgZrIn7ITJ27adLpj8HDo0WqYJTOnf8xIFo1nxIv97bsSl9HF0lWe2KymyA7tIB 4hsM8qi2CqfpqXIPbnIchzCP+bnpEfz9ggFCv2U/tK1MoPqMLrPxR7SBhy5Z4ugfUy1G i+7Zo+35DdzB4mFpbdIZIqT52QQ1PXSHQjG6ybCTg3gaclJC4KSQSuRmAYTlaemKYBbm xvw2kC3T4PPMNXId6zAhs4k+NwFQym2opnht4GoP3FdWh3IoU2p3XJ3cvPm//qw3iLhS K2UyxvKuuDQukVSyQGF8hP52wOM0ptoiXAzphTIaqc6+tHekYs6Gh73XOWjeTXYCC6WU rtaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si6705889pgn.571.2018.02.26.23.34.18; Mon, 26 Feb 2018 23:34:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbeB0HdW (ORCPT + 99 others); Tue, 27 Feb 2018 02:33:22 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:28015 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752023AbeB0HdV (ORCPT ); Tue, 27 Feb 2018 02:33:21 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3zr9Qw6rHKz9v0hl; Tue, 27 Feb 2018 08:33:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id tBiCTqH6QO_I; Tue, 27 Feb 2018 08:33:12 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3zr9Qw5yB9z9v0hZ; Tue, 27 Feb 2018 08:33:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 403258B93C; Tue, 27 Feb 2018 08:33:20 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ATEkQwEeDAep; Tue, 27 Feb 2018 08:33:20 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.5]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 01AD48B92B; Tue, 27 Feb 2018 08:33:19 +0100 (CET) Subject: Re: [PATCH 01/21] powerpc: Remove warning on array size when empty To: Mathieu Malaterre , Andy Shevchenko Cc: Linux Kernel Mailing List , Paul Mackerras , Jiri Slaby , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" References: <20180225172236.29650-1-malat@debian.org> <20180225172236.29650-2-malat@debian.org> From: Christophe LEROY Message-ID: <603d5335-6220-73f2-d902-b92bc74bc79e@c-s.fr> Date: Tue, 27 Feb 2018 08:33:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 27/02/2018 à 08:25, Mathieu Malaterre a écrit : > On Mon, Feb 26, 2018 at 3:45 PM, Andy Shevchenko > wrote: >> On Mon, Feb 26, 2018 at 4:44 PM, Andy Shevchenko >> wrote: >>> On Sun, Feb 25, 2018 at 7:22 PM, Mathieu Malaterre wrote: >> >>>> static void __init check_cpu_feature_properties(unsigned long node) >>>> { >>>> - unsigned long i; >>>> struct feature_property *fp = feature_properties; >>>> const __be32 *prop; >>>> >>> >>> Much simpler is just add >>> >>> if (ARRAY_SIZE() == 0) >>> return; >>> >>>> - for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) { >>>> + for (; fp != feature_properties + ARRAY_SIZE(feature_properties); ++fp) { >> >> ...or convert to while(), which will be more readable. > > So you'd prefer something like: > > while (fp < feature_properties + ARRAY_SIZE(feature_properties)) { > ... > ++fp; > } > > right ? > Why not do as suggested by Segher, ie just replace < by != in the original form ? Or add in front: if (!ARRAY_SIZE(feature_properties)) return; Christophe