hal: check existence of ext disp device before routing

Check existence of ext disp device before routing.

Change-Id: Ie7d0e5c19f704ad067aa0932d62096243c300dae
CRs-Fixed: 2600362
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 77606e8..66add14 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -4167,7 +4167,7 @@
     int disp_type;
     struct platform_data *my_data = (struct platform_data *)platform;
 
-    if (my_data->ext_disp_type != EXT_DISPLAY_TYPE_NONE) {
+    if (my_data->ext_disp_type > EXT_DISPLAY_TYPE_NONE) {
          ALOGD("%s: Returning cached ext disp type:%s",
                __func__, (my_data->ext_disp_type == EXT_DISPLAY_TYPE_DP) ? "DisplayPort" : "HDMI");
          return my_data->ext_disp_type;
@@ -4186,12 +4186,12 @@
         }
 
         disp_type = mixer_ctl_get_value(ctl, 0);
-        if (disp_type == EXT_DISPLAY_TYPE_NONE) {
+        if (disp_type <= EXT_DISPLAY_TYPE_NONE) {
              ALOGE("%s: Invalid external display type: %d", __func__, disp_type);
              return -EINVAL;
         }
-    }else {
-            disp_type = EXT_DISPLAY_TYPE_HDMI;
+    } else {
+        disp_type = EXT_DISPLAY_TYPE_HDMI;
     }
 
     my_data->ext_disp_type = disp_type;