Commit b8cb464e4a8abc60ad5a43e0375fec8a3c728167
Committed by
Linus Torvalds
1 parent
8369744fc4
Exists in
master
and in
20 other branches
ihex: fix unused return value compiler warning
Fix unusued return value compiler warnings due to unchecked write() calls. [akpm@linux-foundation.org: correctly handle short writes] Signed-off-by: Chris Ruffin <cmruffin@gmail.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff
firmware/ihex2fw.c
... | ... | @@ -124,8 +124,7 @@ |
124 | 124 | if (process_ihex(data, st.st_size)) |
125 | 125 | return 1; |
126 | 126 | |
127 | - output_records(outfd); | |
128 | - return 0; | |
127 | + return output_records(outfd); | |
129 | 128 | } |
130 | 129 | |
131 | 130 | static int process_ihex(uint8_t *data, ssize_t size) |
132 | 131 | |
... | ... | @@ -269,12 +268,14 @@ |
269 | 268 | |
270 | 269 | p->addr = htonl(p->addr); |
271 | 270 | p->len = htons(p->len); |
272 | - write(outfd, &p->addr, writelen); | |
271 | + if (write(outfd, &p->addr, writelen) != writelen) | |
272 | + return 1; | |
273 | 273 | p = p->next; |
274 | 274 | } |
275 | 275 | /* EOF record is zero length, since we don't bother to represent |
276 | 276 | the type field in the binary version */ |
277 | - write(outfd, zeroes, 6); | |
277 | + if (write(outfd, zeroes, 6) != 6) | |
278 | + return 1; | |
278 | 279 | return 0; |
279 | 280 | } |