Skip to content

Commit dcc0967

Browse files
Chris LewAndy Gross
authored andcommitted
soc: qcom: smem: Read version from the smem header
The SMEM header structure includes the version information. Read the version directly from the header instead of getting an item from the global heap. Signed-off-by: Chris Lew <clew@codeaurora.org> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
1 parent a216000 commit dcc0967

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

drivers/soc/qcom/smem.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@
6363
*/
6464

6565
/*
66-
* Item 3 of the global heap contains an array of versions for the various
67-
* software components in the SoC. We verify that the boot loader version is
68-
* what the expected version (SMEM_EXPECTED_VERSION) as a sanity check.
66+
* The version member of the smem header contains an array of versions for the
67+
* various software components in the SoC. We verify that the boot loader
68+
* version is a valid version as a sanity check.
6969
*/
70-
#define SMEM_ITEM_VERSION 3
71-
#define SMEM_MASTER_SBL_VERSION_INDEX 7
72-
#define SMEM_EXPECTED_VERSION 11
70+
#define SMEM_MASTER_SBL_VERSION_INDEX 7
71+
#define SMEM_EXPECTED_VERSION 11
7372

7473
/*
7574
* The first 8 items are only to be allocated by the boot loader while
@@ -604,19 +603,11 @@ EXPORT_SYMBOL(qcom_smem_get_free_space);
604603

605604
static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
606605
{
606+
struct smem_header *header;
607607
__le32 *versions;
608-
size_t size;
609-
610-
versions = qcom_smem_get_global(smem, SMEM_ITEM_VERSION, &size);
611-
if (IS_ERR(versions)) {
612-
dev_err(smem->dev, "Unable to read the version item\n");
613-
return -ENOENT;
614-
}
615608

616-
if (size < sizeof(unsigned) * SMEM_MASTER_SBL_VERSION_INDEX) {
617-
dev_err(smem->dev, "Version item is too small\n");
618-
return -EINVAL;
619-
}
609+
header = smem->regions[0].virt_base;
610+
versions = header->version;
620611

621612
return le32_to_cpu(versions[SMEM_MASTER_SBL_VERSION_INDEX]);
622613
}

0 commit comments

Comments
 (0)