Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2763071pxk; Sun, 6 Sep 2020 12:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT+LTo/0WFg7GR4E/sFR+WfwgWNF9tKerqlN7D9do7hrZ0kmFtH1H8TZirFkD0R4ox53Uf X-Received: by 2002:a05:6402:1694:: with SMTP id a20mr18095385edv.286.1599420712554; Sun, 06 Sep 2020 12:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599420712; cv=none; d=google.com; s=arc-20160816; b=O0y4oW0/fx3ki/vn2AyJP9UceBl7P01SaDfaneMXT2fqFR68U8zWTmELJP2E8fAwcm 8h74hsmtMkoJWpfIdGH/StLLWjDRv25yz2KIJuWkFAj9yinL1R8sVrT+ruDzIU2qFW5+ WR4Lkas9hRWWR7zmJfujOG5a8fVWcYjrG2A4QPRdJnKdC0wtwfuFYXmIBAiw0LBpMuQ8 GmGPz4ep1qFpuUHXjZ97iNMJ9zVdfim0H8wL3YeL74vGZZ6r+vUpGI1xdC6awdSwZO9w 0iyaq9QcgDrGu8/mYeAExAwhdZaHNrVOY7/f7T/PBrCkxARtZuZ/+W4ubGFhB4aTVj0l YQzQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AyGUD/j8DvKbTVq8zvcMLRaB6iYfy1kwUhVCXGle+00=; b=CJPpE0F0EuZSmIeH/Y10Zk7zJH+JFbEQM6QoRZA0Vg0AMnSC/Os+QyUgfnX5JNkZAB R+XZsq6I545ifg2BvKmUfkOEIbfJyvYEU+lwBqhb0qnD9zmwBMc294HGT+ZMmhnkECff 02CuYJGhMKVflft0t//CniXvV7H3wdeSLhvmQO+HEF67yBAAHYPUBaOrV3zbgCuytYtJ xJoTIOvzZQzjC+YhYbA4fHBhvFhXL5hzVe2rPbm3V6/4bYQ1tHMD4sIKdpVJN3ZBQfFh EqwDIOwtLYLG327QPUVODzTPYyPtjrWnJ3lVDWlVrGDnmY0pWFrLWo8WPdQ1Hlt2eUjg PL2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=VUmf7L24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si8415307ejy.466.2020.09.06.12.31.30; Sun, 06 Sep 2020 12:31:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=VUmf7L24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726537AbgIFTaa (ORCPT + 99 others); Sun, 6 Sep 2020 15:30:30 -0400 Received: from crapouillou.net ([89.234.176.41]:35806 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbgIFTa3 (ORCPT ); Sun, 6 Sep 2020 15:30:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1599420588; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AyGUD/j8DvKbTVq8zvcMLRaB6iYfy1kwUhVCXGle+00=; b=VUmf7L24ZSer5mF5iF3s0d2OSHpShS6bXAIAK4IGK/iuZI07+UL4D3a57SvnwxdWQXFDus JToRAl+ui7DR5rjDLN3ZX0S3Af8bmljXqVplaCJj55QHbveUwsEY67gUax2uoz1bcmcw4t jqoAfnTkLEofb3Z2wsu1zr6phWmQfe8= From: Paul Cercueil To: Thomas Bogendoerfer Cc: "Maciej W . Rozycki" , Paul Burton , Zhou Yanjie , od@zcrc.me, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 04/15] MIPS: cpu-probe: ingenic: Fix broken BUG_ON Date: Sun, 6 Sep 2020 21:29:24 +0200 Message-Id: <20200906192935.107086-5-paul@crapouillou.net> In-Reply-To: <20200906192935.107086-1-paul@crapouillou.net> References: <20200906192935.107086-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous code was doing: BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter); This only worked as the "cpu_has_counter" macro was overridden in . The default "cpu_has_counter" macro is non-constant, which triggered the BUG_ON() independently of the value returned by the macro. What we want to check here, is that *if* the macro was overridden to a compile-time constant, then must be defined to zero, otherwise it's a bug. So the correct check is: BUG_ON(__builtin_constant_p(cpu_has_counter) && cpu_has_counter); Signed-off-by: Paul Cercueil --- Notes: v2-v3: No change arch/mips/kernel/cpu-probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index a07e66a6e063..6be23f205e74 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -2123,7 +2123,7 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) /* XBurst does not implement the CP0 counter. */ c->options &= ~MIPS_CPU_COUNTER; - BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter); + BUG_ON(__builtin_constant_p(cpu_has_counter) && cpu_has_counter); /* XBurst has virtually tagged icache */ c->icache.flags |= MIPS_CACHE_VTAG; -- 2.28.0