diff mbox series

[04/10] drm/amd/display: Remove unused temp variable

Message ID 20220222131701.356117-5-maira.canal@usp.br (mailing list archive)
State New, archived
Headers show
Series Fix multiple compilation warnings | expand

Commit Message

Maíra Canal Feb. 22, 2022, 1:16 p.m. UTC
Remove unused temp variable from the dmub_rb_flush_pending function by
using arithmetic to remove the loop.

The -Wunused-but-set-variable warning was pointed out by Clang with the
following warning:

drivers/gpu/drm/amd/amdgpu/../display/dmub/inc/dmub_cmd.h:2921:12: warning:
variable 'temp' set but not used [-Wunused-but-set-variable]
    uint64_t temp;
             ^

Signed-off-by: Maíra Canal <maira.canal@usp.br>
---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Alex Deucher Feb. 22, 2022, 4:31 p.m. UTC | #1
Applied.  Thanks!

Alex

On Tue, Feb 22, 2022 at 8:18 AM Maíra Canal <maira.canal@usp.br> wrote:
>
> Remove unused temp variable from the dmub_rb_flush_pending function by
> using arithmetic to remove the loop.
>
> The -Wunused-but-set-variable warning was pointed out by Clang with the
> following warning:
>
> drivers/gpu/drm/amd/amdgpu/../display/dmub/inc/dmub_cmd.h:2921:12: warning:
> variable 'temp' set but not used [-Wunused-but-set-variable]
>     uint64_t temp;
>              ^
>
> Signed-off-by: Maíra Canal <maira.canal@usp.br>
> ---
>  drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 5 +----
>  1 file changed, 1 insertion(+), 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 fb01ff49e655..d3088836d4e4 100644
> --- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
> +++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
> @@ -2918,11 +2918,8 @@ static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
>         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;
> -               uint8_t i;
>
> -               for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
> -                       temp = *data++;
> +               *data += DMUB_RB_CMD_SIZE / sizeof(uint64_t);
>
>                 rptr += DMUB_RB_CMD_SIZE;
>                 if (rptr >= rb->capacity)
> --
> 2.35.1
>
diff mbox series

Patch

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 fb01ff49e655..d3088836d4e4 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -2918,11 +2918,8 @@  static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
 	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;
-		uint8_t i;
 
-		for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
-			temp = *data++;
+		*data += DMUB_RB_CMD_SIZE / sizeof(uint64_t);
 
 		rptr += DMUB_RB_CMD_SIZE;
 		if (rptr >= rb->capacity)