diff options
author | Alex Elder <elder@linaro.org> | 2018-04-10 18:25:42 -0400 |
---|---|---|
committer | Andy Gross <andy.gross@linaro.org> | 2018-05-25 16:53:56 -0400 |
commit | 11d2e7edac6ad221eaf14fdc9ea2f0ddf950a839 (patch) | |
tree | 39c4893221d4ebaac15df69342bc88c363ab31da | |
parent | 8fa1a21409da6abfe890f66532f9fcd8d2c25a3d (diff) |
soc: qcom: smem: check sooner in qcom_smem_set_global_partition()
There's no sense in scanning the partition table again if we know
the global partition has already been discovered. Check for a
non-null global_partition pointer in qcom_smem_set_global_partition()
immediately.
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
-rw-r--r-- | drivers/soc/qcom/smem.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 6e42599b70d4..7d9a43da5084 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c | |||
@@ -364,6 +364,11 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, | |||
364 | end = phdr_to_last_uncached_entry(phdr); | 364 | end = phdr_to_last_uncached_entry(phdr); |
365 | cached = phdr_to_last_cached_entry(phdr); | 365 | cached = phdr_to_last_cached_entry(phdr); |
366 | 366 | ||
367 | if (smem->global_partition) { | ||
368 | dev_err(smem->dev, "Already found the global partition\n"); | ||
369 | return -EINVAL; | ||
370 | } | ||
371 | |||
367 | while (hdr < end) { | 372 | while (hdr < end) { |
368 | if (hdr->canary != SMEM_PRIVATE_CANARY) | 373 | if (hdr->canary != SMEM_PRIVATE_CANARY) |
369 | goto bad_canary; | 374 | goto bad_canary; |
@@ -729,11 +734,6 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) | |||
729 | return -EINVAL; | 734 | return -EINVAL; |
730 | } | 735 | } |
731 | 736 | ||
732 | if (smem->global_partition) { | ||
733 | dev_err(smem->dev, "Already found the global partition\n"); | ||
734 | return -EINVAL; | ||
735 | } | ||
736 | |||
737 | header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); | 737 | header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); |
738 | host0 = le16_to_cpu(header->host0); | 738 | host0 = le16_to_cpu(header->host0); |
739 | host1 = le16_to_cpu(header->host1); | 739 | host1 = le16_to_cpu(header->host1); |