From patchwork Thu Mar 14 07:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yipeng Zou X-Patchwork-Id: 13592221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 204CFC5475B for ; Thu, 14 Mar 2024 07:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=gdj7risAboBtl6Tn7CaCiTRSBphG3gthdqESkx6kPaE=; b=rDg5AG+6NgDf13 WpnWe9rqP1MveLOjPPzQNh4wEpIxDmsQt6fjSzwuYyXC6HG+DSVYLggKRm/vdgkRGG9egQ9hRijfB nCSa/O0YGbu/y/7cfL2XuV+8tcxvAwTWD7QbYPB6ZZth9EPFVYy/iALbzdDxFBYsKFZz53jAjh9rj 44EXAsx9CKUh+2YrQXAii5wp1z179UvtM5S6pbo0FnaC+ionibrKGtofImtqc2V96zX+xUB2ze/a8 ZG6Ui5mowq3NtzRCPB4K+nvVaNVLQsbQe8GEWiLt7+qgqZk3ufgJ4b45tLw+j9KTUGFmgPkbQAC5N yIDGbct7HeS7KtSteMqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkfvl-0000000DT9R-3cnq; Thu, 14 Mar 2024 07:55:13 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkfvi-0000000DT7a-2ABG for linux-arm-kernel@lists.infradead.org; Thu, 14 Mar 2024 07:55:12 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4TwKNx6r36z1Q9gS; Thu, 14 Mar 2024 15:52:49 +0800 (CST) Received: from canpemm500008.china.huawei.com (unknown [7.192.105.151]) by mail.maildlp.com (Postfix) with ESMTPS id F3DFE18005D; Thu, 14 Mar 2024 15:54:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by canpemm500008.china.huawei.com (7.192.105.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 14 Mar 2024 15:54:57 +0800 From: Yipeng Zou To: , , , , , , , CC: Subject: [PATCH-next] arm: fix clang build warning in include/asm/memory.h Date: Thu, 14 Mar 2024 15:54:09 +0800 Message-ID: <20240314075409.2797149-1-zouyipeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500008.china.huawei.com (7.192.105.151) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_005510_759904_13E777B1 X-CRM114-Status: UNSURE ( 7.49 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is a build error has been founded with build in clang-15.0.4: ./arch/arm/include/asm/memory.h:358:12: error: result of comparison "phys addr_t’ (aka 'unsigned int’) > 4294967295 is always false [-Werror, -Wtautological-type-limit-compare] if (addr > (u32)~0) ~~~~ ^ ~~~~~~~ It will be always goes fail without CONFIG_PHYS_ADDR_T_64BIT. Directly silence it by Use CONFIG_PHYS_ADDR_T_64BIT. Fixes: 981b6714dbd2 ("ARM: provide improved virt_to_idmap() functionality") Signed-off-by: Yipeng Zou --- arch/arm/include/asm/memory.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ef2aa79ece5a..64ced9eb42ff 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -347,14 +347,18 @@ static inline bool arm_has_idmap_alias(void) return IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset != 0; } +#ifdef CONFIG_PHYS_ADDR_T_64BIT #define IDMAP_INVALID_ADDR ((u32)~0) +#endif static inline unsigned long phys_to_idmap(phys_addr_t addr) { if (IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset) { addr += arch_phys_to_idmap_offset; +#ifdef CONFIG_PHYS_ADDR_T_64BIT if (addr > (u32)~0) addr = IDMAP_INVALID_ADDR; +#endif } return addr; }