platform: msm_shared: Fix bugs in partition parser
Fix the polynomial representation for crc32 & return
if GPT partition read fails instead contunuing with
parsing the header.
Change-Id: I7c271351c35bc0829880503013a901d982f66d16
diff --git a/platform/msm_shared/partition_parser.c b/platform/msm_shared/partition_parser.c
index 5cca931..6c0ae6c 100644
--- a/platform/msm_shared/partition_parser.c
+++ b/platform/msm_shared/partition_parser.c
@@ -227,7 +227,10 @@
/* Print out the GPT first */
ret = mmc_read(PROTECTIVE_MBR_SIZE, (unsigned int *)data, BLOCK_SIZE);
if (ret)
+ {
dprintf(CRITICAL, "GPT: Could not read primary gpt from mmc\n");
+ return ret;
+ }
ret = partition_parse_gpt_header(data, &first_usable_lba,
&partition_entry_size, &header_size,
@@ -441,7 +444,7 @@
{
int byte_length = 8; /*length of unit (i.e. byte) */
int msb = 0;
- int polynomial = 0x104C11DB7; /* IEEE 32bit polynomial */
+ int polynomial = 0x04C11DB7; /* IEEE 32bit polynomial */
unsigned int regs = 0xFFFFFFFF; /* init to all ones */
int regs_mask = 0xFFFFFFFF; /* ensure only 32 bit answer */
int regs_msb = 0;