[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_NTkB3xrZnT44pCBXercCT7225V2Ui5XTKsY4H45EcXrA@mail.gmail.com>
Date: Fri, 1 Apr 2022 11:28:31 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Aashish Sharma <shraash@...gle.com>
Cc: Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
Alex Deucher <alexander.deucher@....com>,
Pan Xinhui <Xinhui.Pan@....com>,
David Airlie <airlied@...ux.ie>,
Nicholas Kazlauskas <nicholas.kazlauskas@....com>,
Meenakshikumar Somasundaram <meenakshikumar.somasundaram@....com>,
Jake Wang <haonan.wang2@....com>,
Anson Jacob <Anson.Jacob@....com>,
Guenter Roeck <groeck@...omium.org>,
kernel test robot <lkp@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Daniel Vetter <daniel@...ll.ch>, Wayne Lin <wayne.lin@....com>,
Anthony Koo <Anthony.Koo@....com>
Subject: Re: [PATCH v2] drm/amd/display: Fix unused-but-set-variable warning
Applied. Thanks!
Alex
On Thu, Mar 24, 2022 at 9:46 AM Aashish Sharma <shraash@...gle.com> wrote:
>
> Fix the kernel test robot warning below:
>
> drivers/gpu/drm/amd/amdgpu/../display/dmub/inc/dmub_cmd.h:2893:12:
> warning: variable 'temp' set but not used [-Wunused-but-set-variable]
>
> Replaced the assignment to the unused temp variable with READ_ONCE()
> macro to flush the writes. READ_ONCE() helps avoid the use of
> volatile and makes it obvious from the code that the read here is
> intentional. Also verified on x86 that the generated code is exactly the
> same as before.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Aashish Sharma <shraash@...gle.com>
> ---
> v2: Removed unnecessary volatile qualifier in the typecast and an unnecessary comment. Also reworded the commit message.
> ---
> drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
> index 873ecd04e01d..a58f460f431d 100644
> --- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
> +++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
> @@ -2913,13 +2913,11 @@ static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
> uint32_t wptr = rb->wrpt;
>
> while (rptr != wptr) {
> - uint64_t volatile *data = (uint64_t volatile *)((uint8_t *)(rb->base_address) + rptr);
> - //uint64_t volatile *p = (uint64_t volatile *)data;
> - uint64_t temp;
> + uint64_t *data = (uint64_t *)((uint8_t *)(rb->base_address) + rptr);
> uint8_t i;
>
> for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
> - temp = *data++;
> + (void)READ_ONCE(*data++);
>
> rptr += DMUB_RB_CMD_SIZE;
> if (rptr >= rb->capacity)
> --
> 2.35.1.894.gb6a874cedc-goog
>
Powered by blists - more mailing lists