mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RESEND][PATCH] ALSA: info: Fix llseek return value when using callback
@ 2022-08-17 12:49 Amadeusz Sławiński
  2022-08-17 12:56 ` Amadeusz Sławiński
  2022-08-17 13:15 ` Takashi Iwai
  0 siblings, 2 replies; 5+ messages in thread
From: Amadeusz Sławiński @ 2022-08-17 12:49 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel
  Cc: linux-kernel, Cezary Rojewski, Amadeusz Sławiński

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")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/core/info.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/core/info.c b/sound/core/info.c
index b8058b341178..0b2f04dcb589 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -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;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-17 13:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 12:49 [RESEND][PATCH] ALSA: info: Fix llseek return value when using callback Amadeusz Sławiński
2022-08-17 12:56 ` Amadeusz Sławiński
2022-08-17 13:12   ` Takashi Iwai
2022-08-17 13:38     ` Cezary Rojewski
2022-08-17 13:15 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome