disp: msm: add check for null pointer dereferencing

Add check for null pointers before accessing.

Change-Id: I33deb1e931098c246326a01e743a2db760320471
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
此提交包含在:
Samantha Tran
2021-03-02 12:51:31 -08:00
父節點 f9ff8af5b6
當前提交 e8cbb8822b
共有 3 個檔案被更改,包括 18 行新增4 行删除

查看文件

@@ -502,7 +502,7 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
struct drm_connector *connector;
struct drm_encoder *encoder;
struct drm_connector_state *new_conn_state;
struct sde_connector_state *c_conn_state;
struct sde_connector_state *c_conn_state = NULL;
bool encoder_valid = false;
int i;
@@ -526,12 +526,12 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
for_each_new_connector_in_state(c_state->state, connector,
new_conn_state, i) {
if (new_conn_state->best_encoder == encoder){
if (new_conn_state->best_encoder == encoder) {
c_conn_state = to_sde_connector_state(new_conn_state);
break;
}
}
c_conn_state = to_sde_connector_state(new_conn_state);
if (!c_conn_state) {
SDE_ERROR("could not get connector state\n");
return true;