|
@@ -743,9 +743,13 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem)
|
|
|
|
|
|
for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) {
|
|
|
entry = &ptable->entry[i];
|
|
|
+ if (!le32_to_cpu(entry->offset))
|
|
|
+ continue;
|
|
|
+ if (!le32_to_cpu(entry->size))
|
|
|
+ continue;
|
|
|
+
|
|
|
host0 = le16_to_cpu(entry->host0);
|
|
|
host1 = le16_to_cpu(entry->host1);
|
|
|
-
|
|
|
if (host0 == SMEM_GLOBAL_HOST && host0 == host1) {
|
|
|
found = true;
|
|
|
break;
|
|
@@ -757,11 +761,6 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem)
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- if (!le32_to_cpu(entry->offset) || !le32_to_cpu(entry->size)) {
|
|
|
- dev_err(smem->dev, "Invalid entry for global partition\n");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
header = smem->regions[0].virt_base + le32_to_cpu(entry->offset);
|
|
|
host0 = le16_to_cpu(header->host0);
|
|
|
host1 = le16_to_cpu(header->host1);
|
|
@@ -810,18 +809,16 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem,
|
|
|
|
|
|
for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) {
|
|
|
entry = &ptable->entry[i];
|
|
|
- host0 = le16_to_cpu(entry->host0);
|
|
|
- host1 = le16_to_cpu(entry->host1);
|
|
|
-
|
|
|
- if (host0 != local_host && host1 != local_host)
|
|
|
- continue;
|
|
|
-
|
|
|
if (!le32_to_cpu(entry->offset))
|
|
|
continue;
|
|
|
-
|
|
|
if (!le32_to_cpu(entry->size))
|
|
|
continue;
|
|
|
|
|
|
+ host0 = le16_to_cpu(entry->host0);
|
|
|
+ host1 = le16_to_cpu(entry->host1);
|
|
|
+ if (host0 != local_host && host1 != local_host)
|
|
|
+ continue;
|
|
|
+
|
|
|
if (host0 == local_host)
|
|
|
remote_host = host1;
|
|
|
else
|