Skip to contentSkip to conversation

ALSA: control - add the missing prev_lops2 initialization

PATCH Applied Jaroslav Kysela 2 participants 2 messages Mar 31, 2021 – Apr 1, 2021 Sound

lore
Share & tools
lore

Jaroslav Kysela

author maintainer
#0 lore raw

PATCH 1/1 ALSA: control - add the missing prev_lops2 initialization

As static analysis reported, the prev_lops2 should contain the previous lops2 pointer in snd_ctl_disconnect_layer().

Fixes 3f0638a0333b ("ALSA: control - add layer registration routines")
---
 sound/core/control.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/control.c +3 -1
index 6825ca75daf5..20d707d4ef40 100644
@@ -2074,7 +2074,7 @@ void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops)
 	struct snd_ctl_layer_ops *lops2, *prev_lops2;
 
 	down_write(&snd_ctl_layer_rwsem);
-	for (lops2 = snd_ctl_layer, prev_lops2 = NULL; lops2; lops2 = lops2->next)
+	for (lops2 = snd_ctl_layer, prev_lops2 = NULL; lops2; lops2 = lops2->next) {
 		if (lops2 == lops) {
 			if (!prev_lops2)
 				snd_ctl_layer = lops->next;
@@ -2082,6 +2082,8 @@ void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops)
 				prev_lops2->next = lops->next;
 			break;
 		}
+		prev_lops2 = lops2;
+	}
 	up_write(&snd_ctl_layer_rwsem);
 }
 EXPORT_SYMBOL_GPL(snd_ctl_disconnect_layer);
Signature · 1 line
2.30.2