summaryrefslogtreecommitdiffstats
path: root/include/linux/ihex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ihex.h')
-rw-r--r--include/linux/ihex.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/ihex.h b/include/linux/ihex.h
index 9130f307a420..98cb5ce0b0a0 100644
--- a/include/linux/ihex.h
+++ b/include/linux/ihex.h
@@ -21,14 +21,18 @@ struct ihex_binrec {
uint8_t data[0];
} __attribute__((packed));
+static inline uint16_t ihex_binrec_size(const struct ihex_binrec *p)
+{
+ return be16_to_cpu(p->len) + sizeof(*p);
+}
+
/* Find the next record, taking into account the 4-byte alignment */
static inline const struct ihex_binrec *
__ihex_next_binrec(const struct ihex_binrec *rec)
{
- int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2;
- rec = (void *)&rec->data[next];
+ const void *p = rec;
- return rec;
+ return p + ALIGN(ihex_binrec_size(rec), 4);
}
static inline const struct ihex_binrec *