Received: by 10.223.185.116 with SMTP id b49csp6921218wrg; Wed, 28 Feb 2018 18:56:55 -0800 (PST) X-Google-Smtp-Source: AG47ELua1uVlvKNT8xMFfPB6SGcM4sigDqVHSRz9S3jm5cYRxLlvPFxzqqTVhg+MvOinnCgomNkd X-Received: by 2002:a17:902:550f:: with SMTP id f15-v6mr380293pli.50.1519873015440; Wed, 28 Feb 2018 18:56:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519873015; cv=none; d=google.com; s=arc-20160816; b=V+bznvW/9qNODbTWbrTAplaZS7SLddNZ7l8QHYrTtozIc0DqRozrvZmpqdjBzaw8EQ OudWp8GbvMLaNak209gM6uszBsq3qJBifalLQqraozOndzNzUjE74JGfixwTEUSJBG21 bkhtSwX4RMvUQkoyXh4TebVJNLIcksKkg5eA995MS4giAewx0V7e0gDpwlKfzEYHynwf SuN8HWN5eAR2J+HE8Sj3PPviMcvxuZkPAXlnfSpICeVN8V4wTAb5fpeaigEzEDAjmE8B 3hWKxgM0ZiPRDxmx3ieqCVT97AblVnQSQrPh5cFoA4OO1fGSnyJt4ohRTPZgIpIncVwN Iu9g== 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:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=wrzrV3VLWBHrd9yNiQhVTrY1IitNP1r8uBBw3riGAvA=; b=bvkUpx8KoYjgubshjh1UhypBsZE9NIj+JT+YuzRhXUyQAyG6C5ysYf/RsT4tGUJXYg SFgtrChvlEsWT0C3ReDoX4DCxeyELD+s9DXkHtBucCKm6YBDJJKMth384gkGdkXfQmjl J0mMb12gePogUmXD1ZA3+jio9frn7rvWs3BXnM9f880ELyqpxIV+jqyCfIFA5pmXXINR eYADozhnqQP/beTU7wJIyLyoaFN9iPsMuUFozIqyFFh8tqQ4aRGZErPJBie36rq/km+4 /Mn5Mi2RhWlmyBHqYP4LShrTs6taL1kTcDUxUtFtuGDfxzKLaLcN9AVo/m13XQ41fIsm v8Sg== 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 o13si827914pgd.125.2018.02.28.18.56.40; Wed, 28 Feb 2018 18:56:55 -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 S965576AbeCAC4D convert rfc822-to-8bit (ORCPT + 99 others); Wed, 28 Feb 2018 21:56:03 -0500 Received: from ozlabs.org ([103.22.144.67]:39741 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965488AbeCAC4C (ORCPT ); Wed, 28 Feb 2018 21:56:02 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 3zsHB84KXMz9s2B; Thu, 1 Mar 2018 13:56:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Mathieu Malaterre Cc: Benjamin Herrenschmidt , Paul Mackerras , Jiri Slaby , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Mathieu Malaterre Subject: Re: [PATCH 01/21] powerpc: Remove warning on array size when empty In-Reply-To: <20180225172236.29650-2-malat@debian.org> References: <20180225172236.29650-1-malat@debian.org> <20180225172236.29650-2-malat@debian.org> Date: Thu, 01 Mar 2018 13:55:57 +1100 Message-ID: <87woyw8pxe.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Malaterre writes: > When neither CONFIG_ALTIVEC, nor CONFIG_VSX or CONFIG_PPC64 is defined, the > array feature_properties is defined as an empty array, which in turn > triggers the following warning (treated as error on W=1): > > CC arch/powerpc/kernel/prom.o > arch/powerpc/kernel/prom.c: In function ‘check_cpu_feature_properties’: > arch/powerpc/kernel/prom.c:298:16: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) { > ^ > cc1: all warnings being treated as errors Ugh, that's annoying. This seems to work? diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 4dffef947b8a..5215119e249c 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -291,11 +291,11 @@ static inline void identical_pvr_fixup(unsigned long node) static void __init check_cpu_feature_properties(unsigned long node) { - unsigned long i; struct feature_property *fp = feature_properties; const __be32 *prop; + int i; - for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) { + for (i = 0; i < (int)ARRAY_SIZE(feature_properties); ++i, ++fp) { prop = of_get_flat_dt_prop(node, fp->name, NULL); if (prop && be32_to_cpup(prop) >= fp->min_value) { cur_cpu_spec->cpu_features |= fp->cpu_feature; cheers