Skip to content

Commit d5a1ca7

Browse files
tiwaigregkh
authored andcommitted
ALSA: control: Avoid WARN() for symlink errors
[ Upstream commit b2e538a ] Using WARN() for showing the error of symlink creations don't give more information than telling that something goes wrong, since the usual code path is a lregister callback from each control element creation. More badly, the use of WARN() rather confuses fuzzer as if it were serious issues. This patch downgrades the warning messages to use the normal dev_err() instead of WARN(). For making it clearer, add the function name to the prefix, too. Fixes: a135dfb ("ALSA: led control - add sysfs kcontrol LED marking layer") Reported-by: [email protected] Closes: https://lore.kernel.org/[email protected] Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 131798a commit d5a1ca7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sound/core/control_led.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,16 @@ static void snd_ctl_led_sysfs_add(struct snd_card *card)
688688
goto cerr;
689689
led->cards[card->number] = led_card;
690690
snprintf(link_name, sizeof(link_name), "led-%s", led->name);
691-
WARN(sysfs_create_link(&card->ctl_dev->kobj, &led_card->dev.kobj, link_name),
692-
"can't create symlink to controlC%i device\n", card->number);
693-
WARN(sysfs_create_link(&led_card->dev.kobj, &card->card_dev.kobj, "card"),
694-
"can't create symlink to card%i\n", card->number);
691+
if (sysfs_create_link(&card->ctl_dev->kobj, &led_card->dev.kobj,
692+
link_name))
693+
dev_err(card->dev,
694+
"%s: can't create symlink to controlC%i device\n",
695+
__func__, card->number);
696+
if (sysfs_create_link(&led_card->dev.kobj, &card->card_dev.kobj,
697+
"card"))
698+
dev_err(card->dev,
699+
"%s: can't create symlink to card%i\n",
700+
__func__, card->number);
695701

696702
continue;
697703
cerr:

0 commit comments

Comments
 (0)