[alsa-devel] [TINYCOMPRESS][PATCH 1/1] compress: fix hpointer error when no sample rate

Richard Fitzgerald rf at opensource.wolfsonmicro.com
Thu May 2 15:58:53 CEST 2013

Fixes the oops() in compress_get_hpointer() to return
-ENODATA instead of errno if the sample rate is zero.
The value in errno here is not related to the reason
we are returning an error.

Signed-off-by: Richard Fitzgerald <rf at opensource.wolfsonmicro.com>
 compress.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compress.c b/compress.c
index e80e598..abd0799 100644
--- a/compress.c
+++ b/compress.c
@@ -315,7 +315,7 @@ int compress_get_hpointer(struct compress *compress,
 	if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &kavail))
 		return oops(compress, errno, "cannot get avail");
 	if (0 == kavail.tstamp.sampling_rate)
-		return oops(compress, errno, "invalid paramter");
+		return oops(compress, -ENODATA, "sample rate unknown");
 	*avail = (unsigned int)kavail.avail;
 	time = kavail.tstamp.pcm_io_frames / kavail.tstamp.sampling_rate;
 	tstamp->tv_sec = time;

More information about the Alsa-devel mailing list