Skip to contentSkip to conversation

ALSA: info: Fix llseek return value when using callback

PATCH Superseded Amadeusz Sławiński 1 participant 1 message Aug 17, 2022 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: info: Fix llseek return value when using callback

When using callback there was a flow of

	ret = -EINVAL
	if (callback) {
		offset = callback();
		goto out;
	}
	...
	offset = some other value in case of no callback;
	ret = offset;
out:
	return ret;

which causes the snd_info_entry_llseek() to return -EINVAL when there is callback handler. Fix this by setting "ret" directly to callback return value before jumping to "out".

73029e0ff18d ("ALSA: info - Implement common llseek for binary mode")

---
 sound/core/info.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/info.c +3 -3
index b8058b341178..0b2f04dcb589 100644
@@ -111,9 +111,9 @@ static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig)
 	entry = data->entry;
 	mutex_lock(&entry->access);
 	if (entry->c.ops->llseek) {
-		offset = entry->c.ops->llseek(entry,
-					      data->file_private_data,
-					      file, offset, orig);
+		ret = entry->c.ops->llseek(entry,
+					   data->file_private_data,
+					   file, offset, orig);
 		goto out;
 	}
 
Signature · 1 line
2.25.1