diff options
author | Martin Leung <martin.leung@amd.com> | 2021-02-19 18:04:42 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2022-07-05 16:12:37 -0400 |
commit | e73b386e75586f28b9b58641938ae0feb340bca0 (patch) | |
tree | b7ef10d2e1d88052ee427a99d57363ec6a6ae3f1 | |
parent | 82a562ab5f0a918ef905c29c759b4f0c788754d3 (diff) | |
download | linux-e73b386e75586f28b9b58641938ae0feb340bca0.tar.bz2 |
drm/amd/display: guard for virtual calling destroy_link_encoders
[Why]:
On power down, virtual dal may try to delete link_encoders by
referencing uninitialized res_pool.
[How]:
Added guard against empty res_pool.
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Martin Leung <martin.leung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 795766cb27dd..34a3e1eeb5c4 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -347,10 +347,16 @@ static bool create_link_encoders(struct dc *dc) */ static void destroy_link_encoders(struct dc *dc) { - unsigned int num_usb4_dpia = dc->res_pool->res_cap->num_usb4_dpia; - unsigned int num_dig_link_enc = dc->res_pool->res_cap->num_dig_link_enc; + unsigned int num_usb4_dpia; + unsigned int num_dig_link_enc; int i; + if (!dc->res_pool) + return; + + num_usb4_dpia = dc->res_pool->res_cap->num_usb4_dpia; + num_dig_link_enc = dc->res_pool->res_cap->num_dig_link_enc; + /* A platform without USB4 DPIA endpoints has a fixed mapping between DIG * link encoders and physical display endpoints and does not require * additional link encoder objects. |