Skip to content

Commit

Permalink
drm/amd/display: avoid uninitialized variable warning
Browse files Browse the repository at this point in the history
clang (quite rightly) complains fairly loudly about the newly added
mpc1_get_mpc_out_mux() function returning an uninitialized value if the
'opp_id' checks don't pass.

This may not happen in practice, but the code really shouldn't return
garbage if the sanity checks don't pass.

So just initialize 'val' to zero to avoid the issue.

Fixes: 110b055 ("drm/amd/display: add getter routine to retrieve mpcc mux")
Cc: Josip Pavic <[email protected]>
Cc: Bindu Ramamurthy <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Dec 25, 2020
1 parent 5814bc2 commit 61d7913
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock)
unsigned int mpc1_get_mpc_out_mux(struct mpc *mpc, int opp_id)
{
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
uint32_t val;
uint32_t val = 0;

if (opp_id < MAX_OPP && REG(MUX[opp_id]))
REG_GET(MUX[opp_id], MPC_OUT_MUX, &val);
Expand Down

0 comments on commit 61d7913

Please sign in to comment.