Skip to contentSkip to conversation

drm/amd/display: remove unused variable available

PATCH Applied Tom Rix 2 participants 2 messages Mar 8, 2023

Subsystems (3)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 drm/amd/display: remove unused variable available

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.

---
 .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c   | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +0 -8
index f14217cc16fd..2f0311c42f90 100644
@@ -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;
 		}
Signature · 1 line
2.27.0
Applied
#1 lore raw

Applied. Thanks!

Quoted 50 lines · 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.

---
 .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c   | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +0 -9
index f14217cc16fd..2f0311c42f90 100644
@@ -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