- uint32_t size_read;
- int retval;
-
- if ((retval = fileio_local_read(fileio, 4, buf, &size_read)) != ERROR_OK)
- return retval;
- *data = be_to_h_u32(buf);
-
- return ERROR_OK;
+ size_t size_read;
+ int retval = fileio_local_read(fileio, sizeof(uint32_t), buf, &size_read);
+ if (ERROR_OK == retval && sizeof(uint32_t) != size_read)
+ retval = -EIO;
+ if (ERROR_OK == retval)
+ *data = be_to_h_u32(buf);
+ return retval;