aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Gross <agross@codeaurora.org>2015-08-12 00:48:15 -0400
committerAndy Gross <agross@codeaurora.org>2015-09-09 16:56:52 -0400
commit18912806bbf8bd6e2b5cb12317679790eb0e0ce4 (patch)
tree890fb2c273c728dbd5db602a12823efae6d71368
parent61e19ba99e2a88392dcaee4b5e7f3e23548b8164 (diff)
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. Signed-off-by: Andy Gross <agross@codeaurora.org>
-rw-r--r--drivers/soc/qcom/smem.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 7c2c324c4b10..52365188a1c2 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -258,10 +258,6 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem,
258 size_t alloc_size; 258 size_t alloc_size;
259 void *p; 259 void *p;
260 260
261 /* We're not going to find it if there's no matching partition */
262 if (host >= SMEM_HOST_COUNT || !smem->partitions[host])
263 return -ENOENT;
264
265 phdr = smem->partitions[host]; 261 phdr = smem->partitions[host];
266 262
267 p = (void *)phdr + sizeof(*phdr); 263 p = (void *)phdr + sizeof(*phdr);
@@ -371,8 +367,9 @@ int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
371 if (ret) 367 if (ret)
372 return ret; 368 return ret;
373 369
374 ret = qcom_smem_alloc_private(__smem, host, item, size); 370 if (host < SMEM_HOST_COUNT && __smem->partitions[host])
375 if (ret == -ENOENT) 371 ret = qcom_smem_alloc_private(__smem, host, item, size);
372 else
376 ret = qcom_smem_alloc_global(__smem, item, size); 373 ret = qcom_smem_alloc_global(__smem, item, size);
377 374
378 hwspin_unlock_irqrestore(__smem->hwlock, &flags); 375 hwspin_unlock_irqrestore(__smem->hwlock, &flags);
@@ -428,10 +425,6 @@ static int qcom_smem_get_private(struct qcom_smem *smem,
428 struct smem_private_entry *hdr; 425 struct smem_private_entry *hdr;
429 void *p; 426 void *p;
430 427
431 /* We're not going to find it if there's no matching partition */
432 if (host >= SMEM_HOST_COUNT || !smem->partitions[host])
433 return -ENOENT;
434
435 phdr = smem->partitions[host]; 428 phdr = smem->partitions[host];
436 429
437 p = (void *)phdr + sizeof(*phdr); 430 p = (void *)phdr + sizeof(*phdr);
@@ -484,8 +477,9 @@ int qcom_smem_get(unsigned host, unsigned item, void **ptr, size_t *size)
484 if (ret) 477 if (ret)
485 return ret; 478 return ret;
486 479
487 ret = qcom_smem_get_private(__smem, host, item, ptr, size); 480 if (host < SMEM_HOST_COUNT && __smem->partitions[host])
488 if (ret == -ENOENT) 481 ret = qcom_smem_get_private(__smem, host, item, ptr, size);
482 else
489 ret = qcom_smem_get_global(__smem, item, ptr, size); 483 ret = qcom_smem_get_global(__smem, item, ptr, size);
490 484
491 hwspin_unlock_irqrestore(__smem->hwlock, &flags); 485 hwspin_unlock_irqrestore(__smem->hwlock, &flags);