mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 07:26:48 +07:00
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>
This commit is contained in:
parent
8fa1a21409
commit
11d2e7edac
@ -364,6 +364,11 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem,
|
|||||||
end = phdr_to_last_uncached_entry(phdr);
|
end = phdr_to_last_uncached_entry(phdr);
|
||||||
cached = phdr_to_last_cached_entry(phdr);
|
cached = phdr_to_last_cached_entry(phdr);
|
||||||
|
|
||||||
|
if (smem->global_partition) {
|
||||||
|
dev_err(smem->dev, "Already found the global partition\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
while (hdr < end) {
|
while (hdr < end) {
|
||||||
if (hdr->canary != SMEM_PRIVATE_CANARY)
|
if (hdr->canary != SMEM_PRIVATE_CANARY)
|
||||||
goto bad_canary;
|
goto bad_canary;
|
||||||
@ -729,11 +734,6 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smem->global_partition) {
|
|
||||||
dev_err(smem->dev, "Already found the global partition\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
header = smem->regions[0].virt_base + le32_to_cpu(entry->offset);
|
header = smem->regions[0].virt_base + le32_to_cpu(entry->offset);
|
||||||
host0 = le16_to_cpu(header->host0);
|
host0 = le16_to_cpu(header->host0);
|
||||||
host1 = le16_to_cpu(header->host1);
|
host1 = le16_to_cpu(header->host1);
|
||||||
|
Loading…
Reference in New Issue
Block a user