summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-02-24 16:23:17 -0500
committerFranklin Wei <frankhwei536@gmail.com>2015-02-24 16:27:16 -0500
commite4108a37263040336ba02df1d69f996cc3b20d0d (patch)
tree07e1cf0d07ae52da069c98b2220bddcd1b906cb7 /firmware
parent08724860a8682661ee20b68f7478e0cc1e3f4e05 (diff)
Fix warning in firmware/common/structec.c
Change-Id: I3de9891042b7ae7ce695209c651bd075c861928d
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/structec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/firmware/common/structec.c b/firmware/common/structec.c
index 3f220b0762..fb13eaab51 100644
--- a/firmware/common/structec.c
+++ b/firmware/common/structec.c
@@ -164,8 +164,8 @@ ssize_t ecwrite(int fd, const void *buf, size_t scount,
const char *ecinst, bool ec)
{
char tmp[MAX_STRUCT_SIZE];
- size_t member_size = structec_size(ecinst);
-
+ ssize_t member_size = structec_size(ecinst);
+
if (ec)
{
const char *p = (const char *)buf;
@@ -178,7 +178,11 @@ ssize_t ecwrite(int fd, const void *buf, size_t scount,
memcpy(tmp, p, member_size * amount);
structec_convert(tmp, ecinst, amount, true);
- write(fd, tmp, amount * member_size);
+ ssize_t ret = write(fd, tmp, amount * member_size);
+
+ if(ret != amount * member_size)
+ return ret;
+
p += member_size * amount;
}