* [PATCH] gus: add a check of the status of snd_ctl_add
@ 2018-12-26 1:40 Kangjie Lu
2019-01-01 8:53 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26 1:40 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
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>
---
sound/isa/gus/gus_main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 3b8a0c880db5..33c8b66d5c8a 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -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);
+ }
}
/*
--
2.17.2 (Apple Git-113)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gus: add a check of the status of snd_ctl_add
2018-12-26 1:40 [PATCH] gus: add a check of the status of snd_ctl_add Kangjie Lu
@ 2019-01-01 8:53 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-01-01 8:53 UTC (permalink / raw)
To: Kangjie Lu; +Cc: alsa-devel, Jaroslav Kysela, pakki001, linux-kernel
On Wed, 26 Dec 2018 02:40:51 +0100,
Kangjie Lu wrote:
>
> 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>
The function itself prints the error in most of useful cases, so the
extra error here would be superfluous.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-01 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 1:40 [PATCH] gus: add a check of the status of snd_ctl_add Kangjie Lu
2019-01-01 8:53 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®