From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72A5FC433E0 for ; Wed, 10 Mar 2021 09:10:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B889C64FF2 for ; Wed, 10 Mar 2021 09:10:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B889C64FF2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 36CF01777; Wed, 10 Mar 2021 10:09:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36CF01777 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615367414; bh=yH3APqG7k11FWa/kn2vQ18NBSAXxCurGW49BhEYXNUo=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bm3L1hxtnq1ogMQajXf8lr6t55CNzRxWyuSEvK+eMQkTz8FdSZQzvCsHqQAiIELVt XBn/S1+YhlfBWzMrH+Ybks2xOz64DCwhj/0ub077TtYUqTc9fg2EmJstLN8JN6o5Ih ZqwHtgI8f4QnuHnncxdDoNP2Qhk2X67qxyoxtr4s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 76F5DF8016C; Wed, 10 Mar 2021 10:09:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 78598F801D8; Wed, 10 Mar 2021 10:09:21 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ED6BBF8012F for ; Wed, 10 Mar 2021 10:09:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ED6BBF8012F 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 2144AAD74; Wed, 10 Mar 2021 09:09:06 +0000 (UTC) Date: Wed, 10 Mar 2021 10:09:04 +0100 Message-ID: From: Takashi Iwai To: zuoqilin1@163.com Subject: Re: [PATCH] sound: Remove redundant steps In-Reply-To: <20210310063426.524-1-zuoqilin1@163.com> References: <20210310063426.524-1-zuoqilin1@163.com> 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 Cc: alsa-devel@alsa-project.org, lars@metafoo.de, tiwai@suse.com, broonie@kernel.org, joe@perches.com, zuoqilin X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 10 Mar 2021 07:34:26 +0100, zuoqilin1@163.com wrote: > > From: zuoqilin > > If kzalloc fail,not need free it,so just return > -ENOMEM when kzalloc fail. No, this check is performed after two kzalloc calls, so one might remain if you return immediately there. thanks, Takashi > > Signed-off-by: zuoqilin > --- > sound/core/oss/mixer_oss.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c > index bec9283..eec61dc 100644 > --- a/sound/core/oss/mixer_oss.c > +++ b/sound/core/oss/mixer_oss.c > @@ -800,8 +800,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned > uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); > uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); > if (uinfo == NULL || uctl == NULL) { > - err = -ENOMEM; > - goto __free_only; > + return -ENOMEM; > } > down_read(&card->controls_rwsem); > kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); > @@ -851,8 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned > uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); > uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); > if (uinfo == NULL || uctl == NULL) { > - err = -ENOMEM; > - goto __free_only; > + return -ENOMEM; > } > down_read(&card->controls_rwsem); > kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); > -- > 1.9.1 > >