summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudy Hsiao <judyhsiao@chromium.org>2021-02-17 15:40:48 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-02 07:51:49 +0000
commit88d1b037158b8f7b897bbf0a13b3e940f59ba1ce (patch)
tree9b2ec04601f8435a0ad238fd5390fd00ac4d77af
parent45ec170d7df2aa3b3539ca3e88363fcaee1da807 (diff)
downloadadhd-88d1b037158b8f7b897bbf0a13b3e940f59ba1ce.tar.gz
CRAS: dev_io: change write_streams() return code to unsigned int
1. Fix the return type and the comment of write_streams() as it does not return negative int. 2. Remove unused error check of negative return code from write_streams(). BUG=b:174213995 TEST=`FEATURES=test USE=asan emerge-${BOARD} adhd` Change-Id: I80a1888bdcb00f289c507784dcbef1f8b6bdd952 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2703971 Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org> Tested-by: Judy Hsiao <judyhsiao@chromium.org> Commit-Queue: Judy Hsiao <judyhsiao@chromium.org>
-rw-r--r--cras/src/server/dev_io.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cras/src/server/dev_io.c b/cras/src/server/dev_io.c
index 27c10c68..6b4a0999 100644
--- a/cras/src/server/dev_io.c
+++ b/cras/src/server/dev_io.c
@@ -586,12 +586,13 @@ static int capture_to_streams(struct open_dev *adev)
* write_limit - The maximum number of frames to write to dst.
*
* Returns:
- * The number of frames rendered on success, a negative error code otherwise.
+ * The number of frames rendered on success.
* This number of frames is the minimum of the amount of frames each stream
* could provide which is the maximum that can currently be rendered.
*/
-static int write_streams(struct open_dev **odevs, struct open_dev *adev,
- uint8_t *dst, size_t write_limit)
+static unsigned int write_streams(struct open_dev **odevs,
+ struct open_dev *adev, uint8_t *dst,
+ size_t write_limit)
{
struct cras_iodev *odev = adev->dev;
struct dev_stream *curr;
@@ -775,9 +776,6 @@ int write_output_samples(struct open_dev **odevs, struct open_dev *adev,
/* TODO(dgreid) - This assumes interleaved audio. */
dst = area->channels[0].buf;
written = write_streams(odevs, adev, dst, frames);
- if (written < 0) /* pcm has been closed */
- return (int)written;
-
if (written < (snd_pcm_sframes_t)frames)
/* Got all the samples from client that we can, but it
* won't fill the request. */