diff options
Diffstat (limited to 'sound/core/info_oss.c')
-rw-r--r-- | sound/core/info_oss.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index 83900485dd8c..0dbbb8005570 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c @@ -29,21 +29,17 @@ int snd_oss_info_register(int dev, int num, char *string) return -ENXIO; if (snd_BUG_ON(num < 0 || num >= SNDRV_CARDS)) return -ENXIO; - mutex_lock(&strings); + guard(mutex)(&strings); if (string == NULL) { - if ((x = snd_sndstat_strings[num][dev]) != NULL) { - kfree(x); - x = NULL; - } + x = snd_sndstat_strings[num][dev]; + kfree(x); + x = NULL; } else { x = kstrdup(string, GFP_KERNEL); - if (x == NULL) { - mutex_unlock(&strings); + if (x == NULL) return -ENOMEM; - } } snd_sndstat_strings[num][dev] = x; - mutex_unlock(&strings); return 0; } EXPORT_SYMBOL(snd_oss_info_register); @@ -54,7 +50,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d char *str; snd_iprintf(buf, "\n%s:", id); - mutex_lock(&strings); + guard(mutex)(&strings); for (idx = 0; idx < SNDRV_CARDS; idx++) { str = snd_sndstat_strings[idx][dev]; if (str) { @@ -65,7 +61,6 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d snd_iprintf(buf, "%i: %s\n", idx, str); } } - mutex_unlock(&strings); if (ok < 0) snd_iprintf(buf, " NOT ENABLED IN CONFIG\n"); return ok; |