Skip to content

Commit

Permalink
ALSA: control_led - fix initialization in the mode show callback
Browse files Browse the repository at this point in the history
[ Upstream commit e381a14 ]

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: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210614071710.1786866-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
perexg authored and gregkh committed Jul 20, 2021
1 parent 2955c54 commit 7792151
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/core/control_led.c
Expand Up @@ -397,7 +397,7 @@ static ssize_t show_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev);
const char *str;
const char *str = NULL;

switch (led->mode) {
case MODE_FOLLOW_MUTE: str = "follow-mute"; break;
Expand Down

0 comments on commit 7792151

Please sign in to comment.