Skip to contentSkip to conversation

soc: qcom: smem: Fix errant private access

PATCH Superseded Andy Gross 2 participants 2 messages Aug 15, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Andy Gross

author
#0 lore raw

PATCH 1/1 soc: qcom: smem: Fix errant private access

This patch corrects private partition item access. Instead of falling back to global for instances where we have an actual host and remote partition existing, return the results of the private lookup.

---
 drivers/soc/qcom/smem.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/qcom/smem.c +3 -2
index 7c2c324c..6603201d 100644
@@ -484,8 +484,9 @@ int qcom_smem_get(unsigned host, unsigned item, void **ptr, size_t *size)
 	if (ret)
 		return ret;
 
-	ret = qcom_smem_get_private(__smem, host, item, ptr, size);
-	if (ret == -ENOENT)
+	if (host < SMEM_HOST_COUNT && __smem->partitions[host])
+		ret = qcom_smem_get_private(__smem, host, item, ptr, size);
+	else
 		ret = qcom_smem_get_global(__smem, item, ptr, size);
 
 	hwspin_unlock_irqrestore(__smem->hwlock, &flags);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw
Quoted 14 lines · Andy Gross

This patch corrects private partition item access. Instead of falling back to global for instances where we have an actual host and remote partition existing, return the results of the private lookup.

---
 drivers/soc/qcom/smem.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/qcom/smem.c +0 -0
index 7c2c324c..6603201d 100644

drivers/soc/qcom/smem.c int qcom_smem_get(unsigned host, unsigned item, void **ptr, size_t *size) · line 490

Quoted 9 lines
drivers/soc/qcom/smem.c +3 -2
@@ -484,8 +484,9 @@ int qcom_smem_get(unsigned host, unsigned item, void **ptr, size_t *size)
 	if (ret)
 		return ret;
 
-	ret = qcom_smem_get_private(__smem, host, item, ptr, size);
-	if (ret == -ENOENT)
+	if (host < SMEM_HOST_COUNT && __smem->partitions[host])
+		ret = qcom_smem_get_private(__smem, host, item, ptr, size);
+	else
 		ret = qcom_smem_get_global(__smem, item, ptr, size);

Looks good, but you can drop the if statement in the beginning of the qcom_smem_get_private() now.

Can you please also do the same change in the alloc path, to keep them consistent?

Regards,
Bjorn