summaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2018-06-26 02:58:46 +0200
committerAndy Gross <andy.gross@linaro.org>2018-09-13 23:56:53 +0200
commit100d26e8ce65f33d229912be3bc563a93a786186 (patch)
treee3567c8104ed69a67f9d10d71306a87af1f8b265 /drivers/soc
parentsoc: qcom: smem: rename variable in qcom_smem_get_global() (diff)
downloadlinux-100d26e8ce65f33d229912be3bc563a93a786186.tar.xz
linux-100d26e8ce65f33d229912be3bc563a93a786186.zip
soc: qcom: smem: initialize region struct only when successful
Hold off initializing anything for the array entry representing a memory region in qcom_smem_map_memory() until we know we've successfully mapped it. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/smem.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index b91ecf72a236..938ffb01d155 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -888,6 +888,7 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,
{
struct device_node *np;
struct resource r;
+ resource_size_t size;
int ret;
np = of_parse_phandle(dev->of_node, name, 0);
@@ -900,12 +901,13 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,
of_node_put(np);
if (ret)
return ret;
+ size = resource_size(&r);
- smem->regions[i].aux_base = (u32)r.start;
- smem->regions[i].size = resource_size(&r);
- smem->regions[i].virt_base = devm_ioremap_wc(dev, r.start, resource_size(&r));
+ smem->regions[i].virt_base = devm_ioremap_wc(dev, r.start, size);
if (!smem->regions[i].virt_base)
return -ENOMEM;
+ smem->regions[i].aux_base = (u32)r.start;
+ smem->regions[i].size = size;
return 0;
}