Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b34178e8 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

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: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent daed9052
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -330,13 +330,13 @@ static int msm_ion_get_heap_dt_data(struct device_node *node,


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