ion: msm: Correct msm_ion_parse_dt() error propagation

If a device cannot be created for a child node, or the ID cannot
be retrieved for a heap, then msm_ion_parse_dt() will return ret.
However, under these circumstances, ret has not been updated to
reflect these failures, and as such, msm_ion_probe will erroneously
continue as if the call to msm_ion_parse_dt() had been successful.
Thus, ensure that ret is set before following the error path in
msm_ion_parse_dt().

Change-Id: I241805e2c169fb15bda68c2a375def04790aa20e
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres 2019-10-03 13:54:57 -07:00
commit b34178e823

View file

@ -330,13 +330,13 @@ out:
static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
{
struct ion_platform_data *pdata = 0;
struct ion_platform_data *pdata = NULL;
struct ion_platform_heap *heaps = NULL;
struct device_node *node;
struct platform_device *new_dev = NULL;
const struct device_node *dt_node = pdev->dev.of_node;
const __be32 *val;
int ret = -EINVAL;
int ret;
u32 num_heaps = 0;
int idx = 0;
@ -364,6 +364,7 @@ static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
new_dev = of_platform_device_create(node, NULL, &pdev->dev);
if (!new_dev) {
pr_err("Failed to create device %s\n", node->name);
ret = -EINVAL;
goto free_heaps;
}
of_dma_configure(&new_dev->dev, node, true);
@ -372,6 +373,7 @@ static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
val = of_get_address(node, 0, NULL, NULL);
if (!val) {
pr_err("%s: Unable to find reg key\n", __func__);
ret = -EINVAL;
goto free_heaps;
}
pdata->heaps[idx].id = (u32)of_read_number(val, 1);