lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] drm/amd/display: Fixed the unused-but-set-variable warning
On Thu, Mar 17, 2022 at 7:01 AM Aashish Sharma <shraash@google.com> wrote:
>
> Fixed this kernel test robot warning:
>
> 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.
>
> Signed-off-by: Aashish Sharma <shraash@google.com>
> ---
> drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 5 ++---
> 1 file changed, 2 insertions(+), 3 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..b7981a781701 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,12 @@ 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 *data = (uint64_t volatile *)((uint8_t *)(rb->base_address) + rptr);

also drop the volatile in the typecast

> //uint64_t volatile *p = (uint64_t volatile *)data;

The above commented out code serves no purpose and should be removed as well.

Thanks,
Guenter

> - uint64_t temp;
> 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.723.g4982287a31-goog
>

\
 
 \ /
  Last update: 2022-03-17 15:26    [W:0.043 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site