summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2017-01-13 13:06:09 +1030
committerCyril Bur <cyril.bur@au1.ibm.com>2017-01-17 10:45:09 +1100
commit78210b9b6d7ccf0f9d44a5b05ef7d6974e8fd0b8 (patch)
treed08148ef37923a2b61d58a8a4fbbc051b662e660
parentd8f6d7a4e73e85dc718bd9fb7ef8c23095c32d5a (diff)
downloadphosphor-mboxd-78210b9b6d7ccf0f9d44a5b05ef7d6974e8fd0b8.tar.gz
phosphor-mboxd-78210b9b6d7ccf0f9d44a5b05ef7d6974e8fd0b8.zip
mboxd: Fixup unused-result compilation warning
cc -Wall -O2 -g -I. -DPREFIX="\"MBOXD\"" mboxd.c common.o -o mboxd mboxd.c: In function ‘dispatch_mbox’: mboxd.c:170:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result] read(-context->fds[MTD_FD].fd, context->lpc_mem, context->size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r--mboxd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mboxd.c b/mboxd.c
index e536cd2..1769537 100644
--- a/mboxd.c
+++ b/mboxd.c
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
+#include <inttypes.h>
#include <mtd/mtd-abi.h>
@@ -242,8 +243,13 @@ static int dispatch_mbox(struct mbox_context *context)
* the window...
* This approach is easiest.
*/
- if (context->dirty)
- read(-context->fds[MTD_FD].fd, context->lpc_mem, context->size);
+ if (context->dirty) {
+ r = read(-context->fds[MTD_FD].fd, context->lpc_mem, context->size);
+ if (r != context->size) {
+ MSG_ERR("Short read: %d expecting %"PRIu32"\n", r, context->size);
+ goto out;
+ }
+ }
basepg += get_u16(&req.msg.data[0]);
put_u16(&resp.msg.data[0], basepg);
resp.msg.response = MBOX_R_SUCCESS;
OpenPOWER on IntegriCloud