platform: msm: check for codec ops

Check if the codec driver has registered with ext-display
module. If not, return early with error to avoid crash
where it may try to access codec driver's data.

CRs-Fixed: 2020938
Change-Id: I1bd7c9a8551bff32c4e5c2141e118dc097d906c4
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
diff --git a/drivers/platform/msm/msm_ext_display.c b/drivers/platform/msm/msm_ext_display.c
index 3be414b..d5fc867 100644
--- a/drivers/platform/msm/msm_ext_display.c
+++ b/drivers/platform/msm/msm_ext_display.c
@@ -218,6 +218,12 @@
 		goto end;
 	}
 
+	if (!ext_disp->ops) {
+		pr_err("codec ops not registered\n");
+		ret = -EINVAL;
+		goto end;
+	}
+
 	if (state == EXT_DISPLAY_CABLE_CONNECT) {
 		/* connect codec with interface */
 		*ext_disp->ops = data->codec_ops;