msm: mdss: hdmi: fix potential null deference errors

Fix errors in HDMI and HDCP 2.2 driver code that are
related to potential null pointer deferencing and use of
uninitialized variables.

CRs-Fixed: 1026671
Change-Id: Iecf3d1fe5d5268f043617b3fa920fa97bd05f046
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
This commit is contained in:
Naseer Ahmed 2016-05-12 15:53:31 -07:00 committed by Harsh Sahu
parent 25a3708f14
commit d3c9cb55ae
2 changed files with 22 additions and 4 deletions

View file

@ -666,7 +666,7 @@ static void hdmi_hdcp2p2_link_cb(void *data)
static void hdmi_hdcp2p2_recv_msg(struct hdmi_hdcp2p2_ctrl *ctrl)
{
int rc, timeout_hsync;
int rc = 0, timeout_hsync;
char *recvd_msg_buf = NULL;
struct hdmi_tx_hdcp2p2_ddc_data *ddc_data;
struct hdmi_tx_ddc_ctrl *ddc_ctrl;
@ -689,6 +689,7 @@ static void hdmi_hdcp2p2_recv_msg(struct hdmi_hdcp2p2_ctrl *ctrl)
if (atomic_read(&ctrl->auth_state) == HDCP_STATE_INACTIVE) {
pr_err("hdcp is off\n");
rc = -EINVAL;
goto exit;
}
hdmi_ddc_config(ddc_ctrl);

View file

@ -1228,6 +1228,12 @@ static ssize_t hdmi_tx_sysfs_wta_5v(struct device *dev,
}
mutex_lock(&hdmi_ctrl->tx_lock);
pd = &hdmi_ctrl->pdata.power_data[HDMI_TX_HPD_PM];
if (!pd || !pd->gpio_config) {
DEV_ERR("%s: Error: invalid power data\n", __func__);
ret = -EINVAL;
goto end;
}
ret = kstrtoint(buf, 10, &read);
if (ret) {
@ -3081,13 +3087,19 @@ static inline void hdmi_tx_audio_off(struct hdmi_tx_ctrl *hdmi_ctrl)
static int hdmi_tx_power_off(struct hdmi_tx_ctrl *hdmi_ctrl)
{
struct dss_io_data *io = NULL;
void *pdata = hdmi_tx_get_fd(HDMI_TX_FEAT_PANEL);
void *pdata = NULL;
if (!hdmi_ctrl) {
DEV_ERR("%s: invalid input\n", __func__);
return -EINVAL;
}
pdata = hdmi_tx_get_fd(HDMI_TX_FEAT_PANEL);
if (!pdata) {
DEV_ERR("%s: invalid panel data\n", __func__);
return -EINVAL;
}
io = &hdmi_ctrl->pdata.io[HDMI_TX_CORE_IO];
if (!io->base) {
DEV_ERR("%s: Core io is not initialized\n", __func__);
@ -3580,7 +3592,7 @@ static int hdmi_tx_hdcp_off(struct hdmi_tx_ctrl *hdmi_ctrl)
static void hdmi_tx_update_fps(struct hdmi_tx_ctrl *hdmi_ctrl)
{
void *pdata = pdata = hdmi_tx_get_fd(HDMI_TX_FEAT_PANEL);
void *pdata = NULL;
struct mdss_panel_info *pinfo;
if (!hdmi_ctrl) {
@ -3588,8 +3600,13 @@ static void hdmi_tx_update_fps(struct hdmi_tx_ctrl *hdmi_ctrl)
return;
}
pinfo = &hdmi_ctrl->panel_data.panel_info;
pdata = hdmi_tx_get_fd(HDMI_TX_FEAT_PANEL);
if (!pdata) {
DEV_ERR("%s: invalid panel data\n", __func__);
return;
}
pinfo = &hdmi_ctrl->panel_data.panel_info;
if (!pinfo->dynamic_fps) {
DEV_DBG("%s: Dynamic fps not enabled\n", __func__);
return;