提交 e381a14c 编写于 作者: J Jaroslav Kysela 提交者: Takashi Iwai

ALSA: control_led - fix initialization in the mode show callback

The str variable should be always initialized before use even if
the switch covers all cases. This is a minimalistic fix: Assign NULL,
the sprintf() may print '(null)' if something is corrupted.
Signed-off-by: NJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210614071710.1786866-1-perex@perex.czSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 12c11ba5
...@@ -397,7 +397,7 @@ static ssize_t mode_show(struct device *dev, ...@@ -397,7 +397,7 @@ static ssize_t mode_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev); struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev);
const char *str; const char *str = NULL;
switch (led->mode) { switch (led->mode) {
case MODE_FOLLOW_MUTE: str = "follow-mute"; break; case MODE_FOLLOW_MUTE: str = "follow-mute"; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册