Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2727569pxy; Mon, 3 May 2021 06:47:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5gBu7rlfYacVXo4Zfs0b0QBJQHSxC188DujEaq57miz8ySNf7S19SyJnZhKkjtNL6PT8o X-Received: by 2002:a17:906:1101:: with SMTP id h1mr17267348eja.179.1620049646547; Mon, 03 May 2021 06:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620049646; cv=none; d=google.com; s=arc-20160816; b=yJAiBFVKuD1FZIz3PVf+diWmNSIui/4lDWTFgRxlw52Jn1xwOEq5fEoEeVNRD9pEwb 1h68BYByaiezp3sTWYi6iP60YM4OtEl5eYkDKhO5JFJlfwD2TRrwePxv8waO2xiFRZXT pMS/Zn49B/camswunotFAzj8tq9KZEiYvcZD4JMnDOPlWpeTjMf9cYL6QVDKGPIHNVu9 wkFWJ5TNy6J0PMTbClEbWGnWtXZ6vvdjphwFrHL5LEwp6XiH1eptA+19ROH4exYvZaw3 Dx3K9cC/Dg/4ukXncYVRseRbf8Uoc1G6j7UxkT2F8oIk5kZ0yT/TGp20OWQUYEHvY6u4 sFRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=d8lkXPf047fbVvDRjgsJWBeQtpyDgteD9b93VFhAoFs=; b=eiOmNm+eCZe1CVBqnNbDckQNDi1hf5ZWowLaiCQAnhlWbdk2LJjAqCji+aan+3Zik3 pjbop9uwDpzl/g5PpN2MWiduED6xC4lFD4skoBB0pvdcRFS6tNi3fMZNaIlj5q6YSppj RjGgbmyMtK6tQfaexWtTIZNpO4aV4479UZjaBZX8HqN5q4fAFwwp8CwsbKdYxFck9vSq klqBS1PEMcOVNWUwwWA9TM7TWOhz2AkBk2M38qJcn7ZV06DVsIGCaZsHHnWrFGYEyIsZ qLPHRQaJYLF4hGv0FppGdFWWV1WigtdI7kHkfoWCd4tKnDTTYMRTffzL71Rsw6qS9c4d eXsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v29si314520eda.308.2021.05.03.06.47.00; Mon, 03 May 2021 06:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231653AbhECM3U (ORCPT + 99 others); Mon, 3 May 2021 08:29:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:46854 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhECM3T (ORCPT ); Mon, 3 May 2021 08:29:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 04E45AF31; Mon, 3 May 2021 12:28:26 +0000 (UTC) Date: Mon, 03 May 2021 14:28:25 +0200 Message-ID: From: Takashi Iwai To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Kurt Manucredo Subject: Re: [PATCH 33/69] ALSA: gus: properly handle snd_ctl_add() error In-Reply-To: <20210503115736.2104747-34-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> <20210503115736.2104747-34-gregkh@linuxfoundation.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 03 May 2021 13:57:00 +0200, Greg Kroah-Hartman wrote: > > From: Kurt Manucredo > > snd_gus_init_control() does not properly return any possible error that > might have happened in a call to snd_ctl_add() so resolve this by > propagating the error back up the call change correctly. > > Cc: Takashi Iwai > Signed-off-by: Kurt Manucredo > Signed-off-by: Greg Kroah-Hartman This change doesn't look good, either. It results in the bogus error message "version check failed". If we really want to fix this, it's better to call snd_gus_init_control() from snd_gus_initialize() itself while changing snd_gus_init_control() to return an error code. However, this error is really not what we should be bothered too much. Even if a creation of control element failed, it's no fatal error and nothing really wrong would happen by itself. And, under such a situation, the system memory is already too tight and the OS would hang up sooner or later (or OOM killer starts genocide). thanks, Takashi > --- > sound/isa/gus/gus_main.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c > index b7518122a10d..4c2703ea55fb 100644 > --- a/sound/isa/gus/gus_main.c > +++ b/sound/isa/gus/gus_main.c > @@ -75,10 +75,11 @@ static const struct snd_kcontrol_new snd_gus_joystick_control = { > .put = snd_gus_joystick_put > }; > > -static void snd_gus_init_control(struct snd_gus_card *gus) > +static int 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)); > + return snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus)); > + return 0; > } > > /* > @@ -386,8 +387,7 @@ static int snd_gus_check_version(struct snd_gus_card * gus) > } > strcpy(card->shortname, card->longname); > gus->uart_enable = 1; /* standard GUSes doesn't have midi uart trouble */ > - snd_gus_init_control(gus); > - return 0; > + return snd_gus_init_control(gus); > } > > int snd_gus_initialize(struct snd_gus_card *gus) > -- > 2.31.1 >