[alsa-devel] [TINYCOMPRESS][PATCH 1/1] compress: fix hpointer error when no sample rate
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@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;
On Thu, May 02, 2013 at 02:58:53PM +0100, Richard Fitzgerald wrote:
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@opensource.wolfsonmicro.com
Applied thanks
-- ~Vinod
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");
*avail = (unsigned int)kavail.avail; time = kavail.tstamp.pcm_io_frames / kavail.tstamp.sampling_rate; tstamp->tv_sec = time;return oops(compress, -ENODATA, "sample rate unknown");
-- 1.7.2.5
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Richard Fitzgerald
-
Vinod Koul