提交 70e8ffc5 编写于 作者: H Harry Wentland 提交者: Alex Deucher

drm/amd/display: Fix amdgpu_dm bugs found by smatch

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2760
create_eml_sink() warn: variable dereferenced before check
'aconnector->base.edid_blob_ptr' (see line 2758)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4270
amdgpu_dm_atomic_commit_tail() warn: variable dereferenced before check
'dm_new_crtc_state->stream' (see line 4266)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4417
dm_restore_drm_connector_state() warn: variable dereferenced before
check 'disconnected_acrtc' (see line 4415)
Signed-off-by: NHarry Wentland <harry.wentland@amd.com>
Reviewed-by: NSun peng Li <Sunpeng.Li@amd.com>
Acked-by: NHarry Wentland <harry.wentland@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 cfb071f7
...@@ -2709,7 +2709,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) ...@@ -2709,7 +2709,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
.link = aconnector->dc_link, .link = aconnector->dc_link,
.sink_signal = SIGNAL_TYPE_VIRTUAL .sink_signal = SIGNAL_TYPE_VIRTUAL
}; };
struct edid *edid = (struct edid *) aconnector->base.edid_blob_ptr->data; struct edid *edid;
if (!aconnector->base.edid_blob_ptr || if (!aconnector->base.edid_blob_ptr ||
!aconnector->base.edid_blob_ptr->data) { !aconnector->base.edid_blob_ptr->data) {
...@@ -2721,6 +2721,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) ...@@ -2721,6 +2721,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
return; return;
} }
edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
aconnector->edid = edid; aconnector->edid = edid;
aconnector->dc_em_sink = dc_link_add_remote_sink( aconnector->dc_em_sink = dc_link_add_remote_sink(
...@@ -4198,13 +4200,13 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -4198,13 +4200,13 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode, update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode,
dm_new_con_state, (struct dc_stream_state *)dm_new_crtc_state->stream); dm_new_con_state, (struct dc_stream_state *)dm_new_crtc_state->stream);
if (!dm_new_crtc_state->stream)
continue;
status = dc_stream_get_status(dm_new_crtc_state->stream); status = dc_stream_get_status(dm_new_crtc_state->stream);
WARN_ON(!status); WARN_ON(!status);
WARN_ON(!status->plane_count); WARN_ON(!status->plane_count);
if (!dm_new_crtc_state->stream)
continue;
/*TODO How it works with MPO ?*/ /*TODO How it works with MPO ?*/
if (!dc_commit_planes_to_stream( if (!dc_commit_planes_to_stream(
dm->dc, dm->dc,
...@@ -4337,9 +4339,11 @@ void dm_restore_drm_connector_state(struct drm_device *dev, ...@@ -4337,9 +4339,11 @@ void dm_restore_drm_connector_state(struct drm_device *dev,
return; return;
disconnected_acrtc = to_amdgpu_crtc(connector->encoder->crtc); disconnected_acrtc = to_amdgpu_crtc(connector->encoder->crtc);
acrtc_state = to_dm_crtc_state(disconnected_acrtc->base.state); if (!disconnected_acrtc)
return;
if (!disconnected_acrtc || !acrtc_state->stream) acrtc_state = to_dm_crtc_state(disconnected_acrtc->base.state);
if (!acrtc_state->stream)
return; return;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册