Skip to contentSkip to conversation

compress: fix hpointer error when no sample rate

PATCH In review Richard Fitzgerald 2 participants 2 messages May 2, 2013 – May 23, 2013

lore
Share & tools
lore
#0 lore raw

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.

---
 compress.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
compress.c +1 -1
index e80e598..abd0799 100644
@@ -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;
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 6 lines · Richard Fitzgerald

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.

Applied thanks

--
~Vinod

Quoted 24 lines
---
 compress.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
compress.c +1 -1
index e80e598..abd0799 100644
@@ -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;
Signature · 6 lines
1.7.2.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel