diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2017-01-13 13:06:09 +1030 |
---|---|---|
committer | Cyril Bur <cyril.bur@au1.ibm.com> | 2017-01-17 10:45:09 +1100 |
commit | 78210b9b6d7ccf0f9d44a5b05ef7d6974e8fd0b8 (patch) | |
tree | d08148ef37923a2b61d58a8a4fbbc051b662e660 | |
parent | d8f6d7a4e73e85dc718bd9fb7ef8c23095c32d5a (diff) | |
download | phosphor-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |