Merge "Revert "mmap write/read returns non-zero when writing successfully"" am: 9ea8b0dbb4 am: 28ebff3ba6 am: 62217f1b18
Original change: https://android-review.googlesource.com/c/platform/external/tinyalsa/+/1519782
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I31add29a3e5988213d8733a32f3d83c1843d6fde
diff --git a/src/pcm.c b/src/pcm.c
index 2d9987f..8dc777e 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -1549,14 +1549,8 @@
if ((~pcm->flags) & (PCM_OUT | PCM_MMAP))
return -ENOSYS;
- unsigned int frames = pcm_bytes_to_frames(pcm, count);
- int res = pcm_mmap_transfer(pcm, (void *) data, frames);
-
- if (res < 0) {
- return res;
- }
-
- return (unsigned int) res == frames ? 0 : -EIO;
+ return pcm_mmap_transfer(pcm, (void *)data,
+ pcm_bytes_to_frames(pcm, count));
}
int pcm_mmap_read(struct pcm *pcm, void *data, unsigned int count)
@@ -1564,14 +1558,7 @@
if ((~pcm->flags) & (PCM_IN | PCM_MMAP))
return -ENOSYS;
- unsigned int frames = pcm_bytes_to_frames(pcm, count);
- int res = pcm_mmap_transfer(pcm, data, frames);
-
- if (res < 0) {
- return res;
- }
-
- return (unsigned int) res == frames ? 0 : -EIO;
+ return pcm_mmap_transfer(pcm, data, pcm_bytes_to_frames(pcm, count));
}
/* Returns current read/write position in the mmap buffer with associated time stamp. */