From: Ian Campbell Subject: Re: [PATCH 12/34] xen/arm: psci: Don't need to check if vcpuid is negative Date: Thu, 27 Mar 2014 16:42:13 +0000 Message-ID: <1395938533.22909.196.camel@kazak.uk.xensource.com> References: <1395766541-23979-1-git-send-email-julien.grall@linaro.org> <1395766541-23979-13-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WTDNi-0007fR-0j for xen-devel@lists.xenproject.org; Thu, 27 Mar 2014 16:42:18 +0000 In-Reply-To: <1395766541-23979-13-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, 2014-03-25 at 16:55 +0000, Julien Grall wrote: > vcpuid is unsigned int, therefore the value will never be negative. > > It fixes compilation with clang 3.5: > vpsci.c:29:18: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] > if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) ) > ~~~~~~ ^ ~ These sorts of compiler warnings annoy me because one thing the existing check protects against is someone who changes the type of the variable to a signed type (and vcpuid is often held in a signed type inside Xen I think), at which point the condition can become true. But any way, I expect I'm in the minority here, and in this specific case the type of vcpuid is mandated by the PSCI standard (I think) so: > Signed-off-by: Julien Grall Acked-by: Ian Campbell Ian.