mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: remove unused variable available
@ 2023-03-08 14:10 Tom Rix
  2023-03-08 15:40 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-03-08 14:10 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	qingqing.zhuo, Jun.Lei, mghaddar, candice.li, aric.cyr
  Cc: amd-gfx, dri-devel, linux-kernel, Tom Rix

With gcc and W=1, there is this error
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:297:13: error:
  variable ‘available’ set but not used [-Werror=unused-but-set-variable]
  297 |         int available = 0;
      |             ^~~~~~~~~

Since available is unused, remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c   | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
index f14217cc16fd..2f0311c42f90 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
@@ -294,7 +294,6 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link)
 void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result)
 {
 	int bw_needed = 0;
-	int available = 0;
 	int estimated = 0;
 	int host_router_total_estimated_bw = 0;
 
@@ -373,20 +372,13 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res
 
 		// 1. If due to unplug of other sink
 		if (estimated == host_router_total_estimated_bw) {
-
 			// First update the estimated & max_bw fields
 			if (link->dpia_bw_alloc_config.estimated_bw < estimated) {
-				available = estimated - link->dpia_bw_alloc_config.estimated_bw;
 				link->dpia_bw_alloc_config.estimated_bw = estimated;
 			}
 		}
 		// 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw
 		else {
-
-			// We took from another unplugged/problematic sink to give to us
-			if (link->dpia_bw_alloc_config.estimated_bw < estimated)
-				available = estimated - link->dpia_bw_alloc_config.estimated_bw;
-
 			// We lost estimated bw usually due to plug event of other dpia
 			link->dpia_bw_alloc_config.estimated_bw = estimated;
 		}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: remove unused variable available
  2023-03-08 14:10 [PATCH] drm/amd/display: remove unused variable available Tom Rix
@ 2023-03-08 15:40 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2023-03-08 15:40 UTC (permalink / raw)
  To: Tom Rix
  Cc: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, wenjing.liu,
	qingqing.zhuo, Jun.Lei, mghaddar, candice.li, aric.cyr,
	dri-devel, amd-gfx, linux-kernel

Applied.  Thanks!

On Wed, Mar 8, 2023 at 9:11 AM Tom Rix <trix@redhat.com> wrote:
>
> With gcc and W=1, there is this error
> drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:297:13: error:
>   variable ‘available’ set but not used [-Werror=unused-but-set-variable]
>   297 |         int available = 0;
>       |             ^~~~~~~~~
>
> Since available is unused, remove it.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c   | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
> index f14217cc16fd..2f0311c42f90 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
> @@ -294,7 +294,6 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link)
>  void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result)
>  {
>         int bw_needed = 0;
> -       int available = 0;
>         int estimated = 0;
>         int host_router_total_estimated_bw = 0;
>
> @@ -373,20 +372,13 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res
>
>                 // 1. If due to unplug of other sink
>                 if (estimated == host_router_total_estimated_bw) {
> -
>                         // First update the estimated & max_bw fields
>                         if (link->dpia_bw_alloc_config.estimated_bw < estimated) {
> -                               available = estimated - link->dpia_bw_alloc_config.estimated_bw;
>                                 link->dpia_bw_alloc_config.estimated_bw = estimated;
>                         }
>                 }
>                 // 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw
>                 else {
> -
> -                       // We took from another unplugged/problematic sink to give to us
> -                       if (link->dpia_bw_alloc_config.estimated_bw < estimated)
> -                               available = estimated - link->dpia_bw_alloc_config.estimated_bw;
> -
>                         // We lost estimated bw usually due to plug event of other dpia
>                         link->dpia_bw_alloc_config.estimated_bw = estimated;
>                 }
> --
> 2.27.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-08 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 14:10 [PATCH] drm/amd/display: remove unused variable available Tom Rix
2023-03-08 15:40 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®