OSDN Git Service

msm: mdss: validate codec operations during HPD process
authorTatenda Chipeperekwa <tatendac@codeaurora.org>
Mon, 15 Aug 2016 22:35:09 +0000 (15:35 -0700)
committerTatenda Chipeperekwa <tatendac@codeaurora.org>
Mon, 15 Aug 2016 23:29:41 +0000 (16:29 -0700)
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>
drivers/video/fbdev/msm/msm_ext_display.c

index 5474df6..a212428 100644 (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;
        }