The smpr_[write/read]_block () functions return the number of data bytes actually written. So, we must follow the same convention on checking for errors.