ALSA: info: Fix llseek return value when using callback
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Wed, 17 Aug 2022 12:49:24 +0000 (14:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:11:31 +0000 (11:11 +0200)
commit1825806cc6d07a245e1b25bdf01ab4043d7d753e
tree09ccd79a659f07e94cbe29f9f562a2ca3b59340a
parent8b14b7ed0e5ebcb51e04d7f0caf5504b7462f75f
ALSA: info: Fix llseek return value when using callback

commit 9be080edcca330be4af06b19916c35227891e8bc upstream.

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".

Fixes: 73029e0ff18d ("ALSA: info - Implement common llseek for binary mode")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220817124924.3974577-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/info.c