gus: add a check of the status of snd_ctl_add
PATCH 1/1 gus: add a check of the status of snd_ctl_add
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 <[email protected]>
--- sound/isa/gus/gus_main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
sound/isa/gus/gus_main.c +11 -2
@@ -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); + } }/*
Signature · 1 line
2.17.2 (Apple Git-113)
Quoted 5 lines · Kangjie Lu
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 <[email protected]>
The function itself prints the error in most of useful cases, so the extra error here would be superfluous.
thanks,
Takashi