From b34178e823f81b43194091d8bfe768c19f7865a8 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Thu, 3 Oct 2019 13:54:57 -0700 Subject: [PATCH] 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 --- drivers/staging/android/ion/heaps/msm_ion.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/heaps/msm_ion.c b/drivers/staging/android/ion/heaps/msm_ion.c index 535b23cfc2e2..13e51bc61173 100644 --- a/drivers/staging/android/ion/heaps/msm_ion.c +++ b/drivers/staging/android/ion/heaps/msm_ion.c @@ -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);