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=-15.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 352FAC433E0 for ; Fri, 12 Feb 2021 07:19:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFB6964E57 for ; Fri, 12 Feb 2021 07:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFB6964E57 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5C2CF8D0029; Fri, 12 Feb 2021 02:19:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 570058D0015; Fri, 12 Feb 2021 02:19:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 485908D0029; Fri, 12 Feb 2021 02:19:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 306048D0015 for ; Fri, 12 Feb 2021 02:19:09 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D41F4181AF5D0 for ; Fri, 12 Feb 2021 07:19:08 +0000 (UTC) X-FDA: 77808764376.27.E52F984 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id DF56740001DE for ; Fri, 12 Feb 2021 07:19:04 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 86BA7113E; Thu, 11 Feb 2021 23:19:07 -0800 (PST) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E2C83F73D; Thu, 11 Feb 2021 23:19:03 -0800 (PST) Subject: Re: [PATCH 3/3] dma-contiguous: Type cast MAX_ORDER as unsigned int To: Christoph Hellwig Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, akpm@linux-foundation.org, will@kernel.org, Robin Murphy , Marek Szyprowski , David Hildenbrand , Mark Rutland , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <1613024531-19040-1-git-send-email-anshuman.khandual@arm.com> <1613024531-19040-4-git-send-email-anshuman.khandual@arm.com> <20210211080417.GC14448@lst.de> From: Anshuman Khandual Message-ID: Date: Fri, 12 Feb 2021 12:49:28 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210211080417.GC14448@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DF56740001DE X-Stat-Signature: oa6zngfdajmfjjhtpzpqeaoaour4ig9w Received-SPF: none (arm.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=foss.arm.com; client-ip=217.140.110.172 X-HE-DKIM-Result: none/none X-HE-Tag: 1613114344-331263 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2/11/21 1:34 PM, Christoph Hellwig wrote: > On Thu, Feb 11, 2021 at 11:52:11AM +0530, Anshuman Khandual wrote: >> Type cast MAX_ORDER as unsigned int to fix the following build warning= . >> >> In file included from ./include/linux/kernel.h:14, >> from ./include/asm-generic/bug.h:20, >> from ./arch/arm64/include/asm/bug.h:26, >> from ./include/linux/bug.h:5, >> from ./include/linux/mmdebug.h:5, >> from ./arch/arm64/include/asm/memory.h:166, >> from ./arch/arm64/include/asm/page.h:42, >> from kernel/dma/contiguous.c:46: >> kernel/dma/contiguous.c: In function =E2=80=98rmem_cma_setup=E2=80=99: >> ./include/linux/minmax.h:18:28: warning: comparison of distinct pointe= r >> types lacks a cast >> (!!(sizeof((typeof(x) *)1 =3D=3D (typeof(y) *)1))) >> ^~ >> ./include/linux/minmax.h:32:4: note: in expansion of macro =E2=80=98__= typecheck=E2=80=99 >> (__typecheck(x, y) && __no_side_effects(x, y)) >> ^~~~~~~~~~~ >> ./include/linux/minmax.h:42:24: note: in expansion of macro =E2=80=98_= _safe_cmp=E2=80=99 >> __builtin_choose_expr(__safe_cmp(x, y), \ >> ^~~~~~~~~~ >> ./include/linux/minmax.h:58:19: note: in expansion of macro >> =E2=80=98__careful_cmp=E2=80=99 >> #define max(x, y) __careful_cmp(x, y, >) >> ^~~~~~~~~~~~~ >> kernel/dma/contiguous.c:402:35: note: in expansion of macro =E2=80=98m= ax=E2=80=99 >> phys_addr_t align =3D PAGE_SIZE << max(MAX_ORDER - 1, pageblock_orde= r); >> >> Cc: Christoph Hellwig >> Cc: Marek Szyprowski >> Cc: Robin Murphy >> Cc: iommu@lists.linux-foundation.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> kernel/dma/contiguous.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c >> index 3d63d91cba5c..1c2782349d71 100644 >> --- a/kernel/dma/contiguous.c >> +++ b/kernel/dma/contiguous.c >> @@ -399,7 +399,7 @@ static const struct reserved_mem_ops rmem_cma_ops = =3D { >> =20 >> static int __init rmem_cma_setup(struct reserved_mem *rmem) >> { >> - phys_addr_t align =3D PAGE_SIZE << max(MAX_ORDER - 1, pageblock_orde= r); >> + phys_addr_t align =3D PAGE_SIZE << max((unsigned int)MAX_ORDER - 1, = pageblock_order); >=20 > MAX_ORDER and pageblock_order should be the same type. So either fix Right. > MAX_ORDER to be an unsigned constant, which would be fundamentally > the right thing to do but might cause some fallout, or turn > pageblock_order into an int, which is probably much either as the stub > define of it already has an integer type derived from MAX_ORDER as well= . Right, will change pageblock_order as 'int' which would be easier.