From: "Christian König" <christian.koenig@amd.com>
To: Arnd Bergmann <arnd@kernel.org>,
Alex Deucher <alexander.deucher@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Evan Quan <evan.quan@amd.com>,
Hawking Zhang <Hawking.Zhang@amd.com>,
Huang Rui <ray.huang@amd.com>, shaoyunl <shaoyun.liu@amd.com>,
Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
Jack Zhang <Jack.Zhang1@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] drm/amdgpu: fix clang out-of-range warning
Date: Mon, 27 Sep 2021 14:26:13 +0200 [thread overview]
Message-ID: <998000b4-993a-1053-e1f2-b716dc32ae9b@amd.com> (raw)
In-Reply-To: <20210927121958.941637-1-arnd@kernel.org>
In general that change looks good. But what configuration is that?
Background is that it doesn't make much sense to compile the amdgpu
driver on systems where resource_size_t is only 32bit.
Christian.
Am 27.09.21 um 14:19 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang-14 points out that comparing an 'unsigned int' against a large
> 64-bit constantn is pointless:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1206:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
> res->start > 0x100000000ull)
>
> Rephrase the comparison using the upper_32_bits() macro, which should
> keep it legible while avoiding the warning.
>
> Fixes: 31b8adab3247 ("drm/amdgpu: require a root bus window above 4GB for BAR resize")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index ab3794c42d36..741a55031ca1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1203,7 +1203,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
>
> pci_bus_for_each_resource(root, res, i) {
> if (res && res->flags & (IORESOURCE_MEM | IORESOURCE_MEM_64) &&
> - res->start > 0x100000000ull)
> + upper_32_bits(res->start) != 0)
> break;
> }
>
next prev parent reply other threads:[~2021-09-27 12:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 12:19 [PATCH] drm/amdgpu: fix clang out-of-range warning Arnd Bergmann
2021-09-27 12:26 ` Christian König [this message]
2021-09-28 9:56 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=998000b4-993a-1053-e1f2-b716dc32ae9b@amd.com \
--to=christian.koenig@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Jack.Zhang1@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrey.grodzovsky@amd.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=ray.huang@amd.com \
--cc=shaoyun.liu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox