mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: vmaster: Check follower callback errors
@ 2026-11-26  6:53 Sreeraj S Kurup
  0 siblings, 0 replies; only message in thread
From: Sreeraj S Kurup @ 2026-11-26  6:53 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-kernel, linux-sound, Sreeraj S Kurup

Check the return values of follower_get_val() and
follower_put_val() in sync_followers().

Stop synchronization and return the error when either
callback fails.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/core/vmaster.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index f43144ba2797..88b38ee5ba5f 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -345,17 +345,27 @@ static int sync_followers(struct link_master *master, int old_val, int new_val)
 	struct link_follower *follower;
 	struct snd_ctl_elem_value *uval __free(kfree) =
 		kmalloc_obj(*uval);
+	int err;
 
 	if (!uval)
 		return -ENOMEM;
 	list_for_each_entry(follower, &master->followers, list) {
 		master->val = old_val;
 		uval->id = follower->follower.id;
-		follower_get_val(follower, uval);
+		err = follower_get_val(follower, uval);
+		if (err < 0)
+			goto error;
+
 		master->val = new_val;
-		follower_put_val(follower, uval);
+		err = follower_put_val(follower, uval);
+		if (err < 0)
+			goto error;
 	}
 	return 0;
+
+error:
+	master->val = old_val;
+	return err;
 }
 
 static int master_put(struct snd_kcontrol *kcontrol,
-- 
2.55.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-26  6:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26  6:53 [PATCH] ALSA: vmaster: Check follower callback errors Sreeraj S Kurup

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

all inboxes | Powered by JetHome®