Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chris Ruffin and committed by
Linus Torvalds
b8cb464e 8369744f

+5 -4
+5 -4
firmware/ihex2fw.c
··· 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) ··· 268 269 269 270 p->addr = htonl(p->addr); 270 271 p->len = htons(p->len); 271 - write(outfd, &p->addr, writelen); 272 + if (write(outfd, &p->addr, writelen) != writelen) 273 + return 1; 272 274 p = p->next; 273 275 } 274 276 /* EOF record is zero length, since we don't bother to represent 275 277 the type field in the binary version */ 276 - write(outfd, zeroes, 6); 278 + if (write(outfd, zeroes, 6) != 6) 279 + return 1; 277 280 return 0; 278 281 }