diff options
Diffstat (limited to 'tools/firmware-utils/src/mkzynfw.c')
-rw-r--r-- | tools/firmware-utils/src/mkzynfw.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/firmware-utils/src/mkzynfw.c b/tools/firmware-utils/src/mkzynfw.c index 2cd769de2f..365264ca68 100644 --- a/tools/firmware-utils/src/mkzynfw.c +++ b/tools/firmware-utils/src/mkzynfw.c @@ -444,8 +444,10 @@ csum_init(struct csum_state *css) void -csum_update(uint8_t *p, uint32_t len, struct csum_state *css) +csum_update(void *data, uint32_t len, struct csum_state *css) { + uint8_t *p = data; + if (len == 0) return; @@ -499,19 +501,21 @@ csum_buf(uint8_t *p, uint32_t len) * routines to write data to the output file */ int -write_out_data(FILE *outfile, uint8_t *data, size_t len, +write_out_data(FILE *outfile, void *data, size_t len, struct csum_state *css) { + uint8_t *ptr = data; + errno = 0; - fwrite(data, len, 1, outfile); + fwrite(ptr, len, 1, outfile); if (errno) { ERR("unable to write output file"); return -1; } if (css) { - csum_update(data, len, css); + csum_update(ptr, len, css); } return 0; @@ -541,7 +545,7 @@ write_out_padding(FILE *outfile, size_t len, uint8_t padc, int -write_out_data_align(FILE *outfile, uint8_t *data, size_t len, size_t align, +write_out_data_align(FILE *outfile, void *data, size_t len, size_t align, struct csum_state *css) { size_t padlen; @@ -611,7 +615,7 @@ write_out_mmap(FILE *outfile, struct fw_mmap *mmap, struct csum_state *css) mh->count=0; /* Build user data section */ - data = buf+sizeof(*mh); + data = (char *)buf + sizeof(*mh); data += sprintf(data, "Vendor 1 %d", board->vendor); *data++ = '\0'; data += sprintf(data, "Model 1 %d", BE16_TO_HOST(board->model)); |