msm: ba: Fix issue with multiple BA profiles

Fix NULL pointer dereferencing on enabling multiple
BA profiles. It was due to improper pointer assignment.

CRs-Fixed: 1029211
Change-Id: Ibab903d8aaf4c74d0c35386778a84d9280dbb221
Signed-off-by: Shiju Mathew <shijum@codeaurora.org>
This commit is contained in:
Shiju Mathew 2016-06-15 20:05:26 -04:00 committed by Gerrit - the friendly Code Review server
parent d751061941
commit 6d0ae50f6e

View file

@ -298,7 +298,7 @@ static int parse_ba_dt(struct platform_device *pdev)
struct msm_ba_dev *dev_ctxt = NULL;
struct ba_ctxt *ba_ctxt = msm_ba_get_ba_context();
char *key = NULL;
uint32_t err = 0;
uint32_t err = 0, i = 0;
dev_ctxt = ba_ctxt->dev_ctxt;
@ -315,52 +315,54 @@ static int parse_ba_dt(struct platform_device *pdev)
if (!dev_ctxt->msm_ba_inp_cfg)
return -ENOMEM;
i = 0;
for_each_child_of_node(np, child_np) {
key = "qcom,type";
err = of_property_read_u32(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->input_type);
&dev_ctxt->msm_ba_inp_cfg[i].input_type);
if (err)
goto read_fail;
key = "qcom,name";
err = of_property_read_string(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->name);
&dev_ctxt->msm_ba_inp_cfg[i].name);
if (err)
goto read_fail;
key = "qcom,ba-input";
err = of_property_read_u32(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->ba_ip);
&dev_ctxt->msm_ba_inp_cfg[i].ba_ip);
if (err)
goto read_fail;
key = "qcom,ba-output";
err = of_property_read_u32(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->ba_out);
&dev_ctxt->msm_ba_inp_cfg[i].ba_out);
if (err)
goto read_fail;
key = "qcom,sd-name";
err = of_property_read_string(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->sd_name);
&dev_ctxt->msm_ba_inp_cfg[i].sd_name);
if (err)
goto read_fail;
key = "qcom,ba-node";
err = of_property_read_u32(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->ba_node);
&dev_ctxt->msm_ba_inp_cfg[i].ba_node);
if (err)
goto read_fail;
key = "qcom,user-type";
err = of_property_read_u32(child_np, key,
&dev_ctxt->msm_ba_inp_cfg->input_user_type);
&dev_ctxt->msm_ba_inp_cfg[i].input_user_type);
if (err)
goto read_fail;
dev_ctxt->num_config_inputs++;
i++;
}
dev_ctxt->num_config_inputs = i;
read_fail:
if (err) {