Skip to content

Commit

Permalink
ALSA: gus: add a check of the status of snd_ctl_add
Browse files Browse the repository at this point in the history
snd_ctl_add() could fail, so let's check its status and issue an error
message if it indeed fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Kangjie Lu authored and Takashi Iwai committed Jan 7, 2019
1 parent 4bccb40 commit 0f25e00
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sound/isa/gus/gus_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,17 @@ static const struct snd_kcontrol_new snd_gus_joystick_control = {

static void snd_gus_init_control(struct snd_gus_card *gus)
{
if (!gus->ace_flag)
snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus));
int ret;

if (!gus->ace_flag) {
ret =
snd_ctl_add(gus->card,
snd_ctl_new1(&snd_gus_joystick_control,
gus));
if (ret)
snd_printk(KERN_ERR "gus: snd_ctl_add failed: %d\n",
ret);
}
}

/*
Expand Down

0 comments on commit 0f25e00

Please sign in to comment.