summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2021-03-31 20:07:02 +0200
committerTakashi Iwai <tiwai@suse.de>2021-04-01 10:03:59 +0200
commit016c20506d5c30151196ab28c694ab10bc3604e6 (patch)
treef9232f535f30ea2366c12e4ba7a59f088dbcdf0d /sound/core
parenta135dfb5de1501327895729b4f513370d2555b4d (diff)
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(). Link: https://lore.kernel.org/alsa-devel/96e9bd5c-c8db-0db8-b393-fbf4a047dc80@canonical.com/ Fixes: 3f0638a0333b ("ALSA: control - add layer registration routines") Signed-off-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20210331180702.663489-1-perex@perex.cz Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 6825ca75daf5..20d707d4ef40 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -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);