Skip to contentSkip to conversation

drm/amd/display: Fix Werror when building

PATCH In review Wayne Lin 2 participants 2 messages Oct 8, 2021

Subsystems (3)
lore
Share & tools
lore

Wayne Lin

author
#0 lore raw

PATCH 1/1 drm/amd/display: Fix Werror when building

[Why & How]
Got Werror when building with Clang-13:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:195:2:
error: variable 'ts' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]

        default:

        ^~~~~~~

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:200:9:
note: uninitialized use occurs here

        return ts;

               ^~

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:180:2:
note: variable 'ts' is declared here

        enum dpia_set_config_ts ts;

        ^

1 error generated.

Fix it.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c +1 -0
index 6936b9d549e5..64d2461953c4 100644
@@ -193,6 +193,7 @@ static enum dpia_set_config_ts convert_trng_ptn_to_trng_stg(enum dc_dp_training_
 		ts = DPIA_TS_TPS4;
 		break;
 	default:
+		ts = DPIA_TS_DPRX_DONE;
 		ASSERT(false); /* TPS not supported by helper function. */
 		break;
 	}
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 51 lines · Wayne Lin

[Why & How]
Got Werror when building with Clang-13:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:195:2:
error: variable 'ts' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]

        default:

        ^~~~~~~

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:200:9:
note: uninitialized use occurs here

        return ts;

               ^~

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c:180:2:
note: variable 'ts' is declared here

        enum dpia_set_config_ts ts;

        ^

1 error generated.

Fix it.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c +1 -1
index 6936b9d549e5..64d2461953c4 100644
@@ -193,6 +193,7 @@ static enum dpia_set_config_ts convert_trng_ptn_to_trng_stg(enum dc_dp_training_
                ts = DPIA_TS_TPS4;
                break;
        default:
+               ts = DPIA_TS_DPRX_DONE;
                ASSERT(false); /* TPS not supported by helper function. */
                break;
        }
--

2.25.1