soc: qcom: hab: add error handling when dt item is missing

If certain testgipc node under aliases in device tree is
missing, ep_path remains NULL and it will cause NULL
dereference problem later in the code. We need to go to
error handler and deinitialize everything under this
condition.

Change-Id: I98a27acfb2e8af9687114d610304a31a1ac9c3ca
Signed-off-by: Jiacheng Zheng <jiaczhen@codeaurora.org>
This commit is contained in:
Jiacheng Zheng 2019-06-19 15:01:55 +08:00
parent 291c54b284
commit 7ec9476039

View file

@ -169,6 +169,7 @@ int habhyp_commdev_alloc(void **commdev, int is_be, char *name, int vmid_remote,
mmid_device->name,
mmid_device->id,
dt_name_idx);
of_node_put(gvh_dn);
ret = -ENOENT;
goto err;
}
@ -176,10 +177,14 @@ int habhyp_commdev_alloc(void **commdev, int is_be, char *name, int vmid_remote,
ret = of_property_read_string(gvh_dn,
ghs_vmm_plugin_info.dt_name[dt_name_idx],
&ep_path);
if (ret)
if (ret) {
pr_err("failed to read endpoint str ret %d\n",
ret);
of_node_put(gvh_dn);
ret = -ENOENT;
goto err;
}
of_node_put(gvh_dn);
ep_dn = of_find_node_by_path(ep_path);
if (ep_dn) {