From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09ECC433DB for ; Tue, 23 Mar 2021 13:21:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85DAF61925 for ; Tue, 23 Mar 2021 13:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbhCWNVD (ORCPT ); Tue, 23 Mar 2021 09:21:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:47352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231375AbhCWNUf (ORCPT ); Tue, 23 Mar 2021 09:20:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3407D619BD; Tue, 23 Mar 2021 13:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616505634; bh=nPwiWO5rWIEWx3azZjgsrJ8G5mHv0HQF/NHZR+FmaMs=; h=From:To:Cc:Subject:Date:From; b=U1gkt9hdcmVySja+r/DRV8vG2QEd2/YLya3UDgQSUcEU8+clxHUftMfgo0B/g05L4 t6DwK4bykTWThKrW9Z/LupBgn6nVgNcZcqzYkucPYJN6NNMCPHHobqt3Mc/t4p4bxe n9hsWvg1POWu5jNa6a8/h1c4KudZmyJ8wTOQG/ofFuo/UmR5Gihz9XLht4eG1tYMa4 Gj/js8835MQcKnGp0RrdAHDzTc5XUVgqxzPK9OioHiAdIRDSWtZ2tMDVycV0sKjQ7D VAyZEApXKbVv4QjFblwrQcKdafB0Q8yKnzW+qahjc156DGPe//BJ/dYcDcvcrtSWtb yTObbUhzp9oXA== From: Arnd Bergmann To: Russell King Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ARM: delay: avoid clang -Wtautological-constant warning Date: Tue, 23 Mar 2021 14:20:23 +0100 Message-Id: <20210323132031.2858996-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Passing an 8-bit constant into delay() triggers a warning when building with 'make W=1' using clang: drivers/clk/actions/owl-pll.c:182:2: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] udelay(pll_hw->delay); ^~~~~~~~~~~~~~~~~~~~~ arch/arm/include/asm/delay.h:84:9: note: expanded from macro 'udelay' ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~ arch/arm/mach-omap2/wd_timer.c:89:3: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] udelay(oh->class->sysc->srst_udelay); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shut up the warning by adding a cast to a 64-bit number. A cast to 'int' would usually be sufficient, but would fail to cause a link-time error for large 64-bit constants. Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/delay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 4f80b72372b4..1bb6417a3a83 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -81,7 +81,7 @@ extern void __bad_udelay(void); #define udelay(n) \ (__builtin_constant_p(n) ? \ - ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ + ((u64)(n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ __const_udelay((n) * UDELAY_MULT)) : \ __udelay(n)) -- 2.29.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06790C433DB for ; Tue, 23 Mar 2021 13:22:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6639E61878 for ; Tue, 23 Mar 2021 13:22:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6639E61878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VChkzcKQLRsKMBtZvrDa1dMQxvOfPrHDxvUSFhAwHm8=; b=S3yJ2SA9sMlebGga/1RzyRDMZg 503UMplyUqpkcw3AAIpUZUyduEj26CHcs2ViMExSnhi4cSxcBzbiYwQ2UjNnskpxeknha3Rh8wG5N xWHdLYF/9c3hbFrX/zIChQHpXlKcxIK0P3263/O4bEMA703i+YMdfKWv7r7nmf7IN+iG1Bg/Qp80p 1ZUVIvA0bGPG5t1KRPUuAWD+ukIXQHSTC6h4VFf4eqCoBNJ9/sqmhzaLdySpP2oxulG9bEcY9nvLc yKc0TnN0MkWJxLVGiLL+C9NK+8PERMoMzpvFvrl6ApkQ5uuKxm304X18lk3pj3i/z2HCsfYTmx818 fvcsMJPA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOgxb-00F27b-P7; Tue, 23 Mar 2021 13:20:40 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOgxY-00F26q-AZ for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 13:20:38 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3407D619BD; Tue, 23 Mar 2021 13:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616505634; bh=nPwiWO5rWIEWx3azZjgsrJ8G5mHv0HQF/NHZR+FmaMs=; h=From:To:Cc:Subject:Date:From; b=U1gkt9hdcmVySja+r/DRV8vG2QEd2/YLya3UDgQSUcEU8+clxHUftMfgo0B/g05L4 t6DwK4bykTWThKrW9Z/LupBgn6nVgNcZcqzYkucPYJN6NNMCPHHobqt3Mc/t4p4bxe n9hsWvg1POWu5jNa6a8/h1c4KudZmyJ8wTOQG/ofFuo/UmR5Gihz9XLht4eG1tYMa4 Gj/js8835MQcKnGp0RrdAHDzTc5XUVgqxzPK9OioHiAdIRDSWtZ2tMDVycV0sKjQ7D VAyZEApXKbVv4QjFblwrQcKdafB0Q8yKnzW+qahjc156DGPe//BJ/dYcDcvcrtSWtb yTObbUhzp9oXA== From: Arnd Bergmann To: Russell King Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ARM: delay: avoid clang -Wtautological-constant warning Date: Tue, 23 Mar 2021 14:20:23 +0100 Message-Id: <20210323132031.2858996-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_132036_600407_85A214F1 X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann Passing an 8-bit constant into delay() triggers a warning when building with 'make W=1' using clang: drivers/clk/actions/owl-pll.c:182:2: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] udelay(pll_hw->delay); ^~~~~~~~~~~~~~~~~~~~~ arch/arm/include/asm/delay.h:84:9: note: expanded from macro 'udelay' ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~ arch/arm/mach-omap2/wd_timer.c:89:3: error: result of comparison of constant 2000 with expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] udelay(oh->class->sysc->srst_udelay); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shut up the warning by adding a cast to a 64-bit number. A cast to 'int' would usually be sufficient, but would fail to cause a link-time error for large 64-bit constants. Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/delay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 4f80b72372b4..1bb6417a3a83 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -81,7 +81,7 @@ extern void __bad_udelay(void); #define udelay(n) \ (__builtin_constant_p(n) ? \ - ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ + ((u64)(n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ __const_udelay((n) * UDELAY_MULT)) : \ __udelay(n)) -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel