diff options
Diffstat (limited to 'drivers/soc/qcom/smem.c')
-rw-r--r-- | drivers/soc/qcom/smem.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 938ffb01d155..9378bee4d7d6 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c | |||
@@ -743,9 +743,13 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) | |||
743 | 743 | ||
744 | for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { | 744 | for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { |
745 | entry = &ptable->entry[i]; | 745 | entry = &ptable->entry[i]; |
746 | if (!le32_to_cpu(entry->offset)) | ||
747 | continue; | ||
748 | if (!le32_to_cpu(entry->size)) | ||
749 | continue; | ||
750 | |||
746 | host0 = le16_to_cpu(entry->host0); | 751 | host0 = le16_to_cpu(entry->host0); |
747 | host1 = le16_to_cpu(entry->host1); | 752 | host1 = le16_to_cpu(entry->host1); |
748 | |||
749 | if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { | 753 | if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { |
750 | found = true; | 754 | found = true; |
751 | break; | 755 | break; |
@@ -757,11 +761,6 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) | |||
757 | return -EINVAL; | 761 | return -EINVAL; |
758 | } | 762 | } |
759 | 763 | ||
760 | if (!le32_to_cpu(entry->offset) || !le32_to_cpu(entry->size)) { | ||
761 | dev_err(smem->dev, "Invalid entry for global partition\n"); | ||
762 | return -EINVAL; | ||
763 | } | ||
764 | |||
765 | header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); | 764 | header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); |
766 | host0 = le16_to_cpu(header->host0); | 765 | host0 = le16_to_cpu(header->host0); |
767 | host1 = le16_to_cpu(header->host1); | 766 | host1 = le16_to_cpu(header->host1); |
@@ -810,18 +809,16 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, | |||
810 | 809 | ||
811 | for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { | 810 | for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { |
812 | entry = &ptable->entry[i]; | 811 | entry = &ptable->entry[i]; |
813 | host0 = le16_to_cpu(entry->host0); | ||
814 | host1 = le16_to_cpu(entry->host1); | ||
815 | |||
816 | if (host0 != local_host && host1 != local_host) | ||
817 | continue; | ||
818 | |||
819 | if (!le32_to_cpu(entry->offset)) | 812 | if (!le32_to_cpu(entry->offset)) |
820 | continue; | 813 | continue; |
821 | |||
822 | if (!le32_to_cpu(entry->size)) | 814 | if (!le32_to_cpu(entry->size)) |
823 | continue; | 815 | continue; |
824 | 816 | ||
817 | host0 = le16_to_cpu(entry->host0); | ||
818 | host1 = le16_to_cpu(entry->host1); | ||
819 | if (host0 != local_host && host1 != local_host) | ||
820 | continue; | ||
821 | |||
825 | if (host0 == local_host) | 822 | if (host0 == local_host) |
826 | remote_host = host1; | 823 | remote_host = host1; |
827 | else | 824 | else |