msm: mdss: validate codec operations during HPD process

Validate the codec operations during the HPD process to ensure
that there is no potential null deference. The codec operations
can be invalid if there is no codec registered with the external
display module.

CRs-Fixed: 1009284
Change-Id: I4aa64724a912ae1df07d382d3eb346424b50cf36
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
This commit is contained in:
Tatenda Chipeperekwa 2016-08-15 15:35:09 -07:00
parent 2e45ea7281
commit b6b15c3385

View file

@ -360,10 +360,13 @@ static int msm_ext_disp_hpd(struct platform_device *pdev,
ext_disp->current_disp = data->type;
} else if ((state == EXT_DISPLAY_CABLE_DISCONNECT) &&
!ext_disp->ack_enabled) {
ext_disp->ops->audio_info_setup = NULL;
ext_disp->ops->get_audio_edid_blk = NULL;
ext_disp->ops->cable_status = NULL;
ext_disp->ops->get_intf_id = NULL;
if (ext_disp->ops) {
ext_disp->ops->audio_info_setup = NULL;
ext_disp->ops->get_audio_edid_blk = NULL;
ext_disp->ops->cable_status = NULL;
ext_disp->ops->get_intf_id = NULL;
}
ext_disp->current_disp = EXT_DISPLAY_TYPE_MAX;
}
@ -451,7 +454,7 @@ static int msm_ext_disp_notify(struct platform_device *pdev,
if (ret)
goto end;
if (new_state == EXT_DISPLAY_CABLE_CONNECT) {
if (new_state == EXT_DISPLAY_CABLE_CONNECT && ext_disp->ops) {
ext_disp->ops->audio_info_setup =
data->codec_ops.audio_info_setup;
ext_disp->ops->get_audio_edid_blk =
@ -524,10 +527,13 @@ static int msm_ext_disp_audio_ack(struct platform_device *pdev, u32 ack)
* empty.
*/
if (!ack_hpd) {
ext_disp->ops->audio_info_setup = NULL;
ext_disp->ops->get_audio_edid_blk = NULL;
ext_disp->ops->cable_status = NULL;
ext_disp->ops->get_intf_id = NULL;
if (ext_disp->ops) {
ext_disp->ops->audio_info_setup = NULL;
ext_disp->ops->get_audio_edid_blk = NULL;
ext_disp->ops->cable_status = NULL;
ext_disp->ops->get_intf_id = NULL;
}
ext_disp->current_disp = EXT_DISPLAY_TYPE_MAX;
}