msm: mdss: fix null pointer if wrong params passed on esd config
If wrong parameters are set on the dtsi to configure the
esd, a null pointer access can happen. Fix this to make
sure we check for valid pointers and otherwise just
throw an error, but not access an invalid pointer.
Change-Id: I3df0889c1225dcb613910cb90f050a2994f5834d
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
diff --git a/drivers/video/fbdev/msm/mdss_dsi_panel.c b/drivers/video/fbdev/msm/mdss_dsi_panel.c
index 2ef1695..65d6153 100644
--- a/drivers/video/fbdev/msm/mdss_dsi_panel.c
+++ b/drivers/video/fbdev/msm/mdss_dsi_panel.c
@@ -27,6 +27,8 @@
#ifdef TARGET_HW_MDSS_HDMI
#include "mdss_dba_utils.h"
#endif
+#include "mdss_debug.h"
+
#define DT_CMD_HDR 6
#define MIN_REFRESH_RATE 48
#define DEFAULT_MDP_TRANSFER_TIME 14000
@@ -1683,7 +1685,7 @@
static bool mdss_dsi_cmp_panel_reg_v2(struct mdss_dsi_ctrl_pdata *ctrl)
{
- int i, j;
+ int i, j = 0;
int len = 0, *lenp;
int group = 0;
@@ -1692,6 +1694,15 @@
for (i = 0; i < ctrl->status_cmds.cmd_cnt; i++)
len += lenp[i];
+ for (i = 0; i < len; i++) {
+ pr_debug("[%i] return:0x%x status:0x%x\n",
+ i, (unsigned int)ctrl->return_buf[i],
+ (unsigned int)ctrl->status_value[j + i]);
+ MDSS_XLOG(ctrl->ndx, ctrl->return_buf[i],
+ ctrl->status_value[j + i]);
+ j += len;
+ }
+
for (j = 0; j < ctrl->groups; ++j) {
for (i = 0; i < len; ++i) {
if (ctrl->return_buf[i] !=