Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2575611pxm; Mon, 28 Feb 2022 01:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuX5Zmmkfpgjs0J+vSmngy2B2vKhpR27KrzHJHjvhoRxK+kzt4jVfHR0DJ6k5u2WN2GUSU X-Received: by 2002:a17:906:1e0c:b0:6cf:d014:e454 with SMTP id g12-20020a1709061e0c00b006cfd014e454mr15048203ejj.583.1646041382416; Mon, 28 Feb 2022 01:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646041382; cv=none; d=google.com; s=arc-20160816; b=0bGK1sB8ROvevbwR1r9HO78P4XiRGfwivpDiZMDNW0+ALWAniW3Q5bS0a+WBHh3L15 KGL0WYls7O9adHhM3N6Mbu7ZvAnyvLPhzWAI1Wdm1gD8Sb1+VyGWLXVpWTiiAVCA1Nv/ 5dsroAyVYGFPOTnnTulU2UJyNvgF/bF7vjx7LgsOVz/4xuhB5AfM2S28xmokWJjZTBzT AGasKjds41uHwaD2G9eFFpsC7mFbBjmepEDctZxLpsMRlf9m6KWjjw7aIX+uIao//WxA yyBu996CD72Yu2BFzZ0otbI9HkusFlEAg2KRx1hMEY2x14e/2BPWYu0Gd3P1h3NcKVGr UA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=YXACzVeYQS0t5lyyDkmIjsDWSXnpwOMy1AvxPxKkEv0=; b=P1MS0eNZB+TKvJ61oLlaHnUCPHGi+WczBafhmkd50Os7ge916MExGR+bs9rMS9Rg4y U9McNKsZhiO+vasOPflK6WyGfESkdeGw/o1lNL6nZ4HPhcdOcVOMF1ncn7EW1vRK0gEs sq5UVtJ9n7fO1slnVcKXtPXYf5tbqvt9C0udZyXIIjG99KQ+sSPTOCj+hhHZPUpnIOyi TXpYhuI79k34hM1CvXRe0iv3WzkOo+E0hVTieqasL0TZnzSgIPCxq7kKMnNzizq3muWy EusITz3s/NMRxSInKKzqqz7y6+yGusIVaTrfxhuAlJOvRIRymBMwwJl6MWIWKHt8r3dp GtSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a05640211c800b00404bf03dc31si8144609edw.520.2022.02.28.01.42.38; Mon, 28 Feb 2022 01:43:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232048AbiB1FVd (ORCPT + 99 others); Mon, 28 Feb 2022 00:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbiB1FVb (ORCPT ); Mon, 28 Feb 2022 00:21:31 -0500 Received: from relay5.hostedemail.com (relay5.hostedemail.com [64.99.140.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A58939B83 for ; Sun, 27 Feb 2022 21:20:54 -0800 (PST) Received: from omf03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F2F3FE15; Mon, 28 Feb 2022 05:20:52 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA id BECCA60010; Mon, 28 Feb 2022 05:20:13 +0000 (UTC) Message-ID: Subject: Re: [PATCH v4 2/2] ALSA: core: Remove redundant variable and return the last statement From: Joe Perches To: Meng Tang , perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Date: Sun, 27 Feb 2022 21:20:45 -0800 In-Reply-To: <20220228050253.1649-2-tangmeng@uniontech.com> References: <20220228050253.1649-1-tangmeng@uniontech.com> <20220228050253.1649-2-tangmeng@uniontech.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: BECCA60010 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Stat-Signature: hruc7nct77mkwtg4ah8jw8qrpgawattj X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19B4PH4dJJF2uojux2T7euYun9bMLaYrIU= X-HE-Tag: 1646025613-188090 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-02-28 at 13:02 +0800, Meng Tang wrote: > Return the result from file->f_op->open() directly instead of > taking this in another redundant variable. Make the typical > return the last statement, return early and reduce the indentation > too. > > Signed-off-by: Meng Tang > Signed-off-by: Joe Perches Hi Meng Tang. For the next time: it's not necessary (or even good) to add a sign-off for another person unless they specifically authorize one. You wrote and are submitting these changes, I merely gave you simple suggestions as to how you could improve them. cheers, Joe > --- > sound/sound_core.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/sound/sound_core.c b/sound/sound_core.c > index aa4a57e488e5..3332fe321737 100644 > --- a/sound/sound_core.c > +++ b/sound/sound_core.c > @@ -577,20 +577,20 @@ static int soundcore_open(struct inode *inode, struct file *file) > new_fops = fops_get(s->unit_fops); > } > spin_unlock(&sound_loader_lock); > - if (new_fops) { > - /* > - * We rely upon the fact that we can't be unloaded while the > - * subdriver is there. > - */ > - int err = 0; > - replace_fops(file, new_fops); > > - if (file->f_op->open) > - err = file->f_op->open(inode,file); > + if (!new_fops) > + return -ENODEV; > > - return err; > - } > - return -ENODEV; > + /* > + * We rely upon the fact that we can't be unloaded while the > + * subdriver is there. > + */ > + replace_fops(file, new_fops); > + > + if (!file->f_op->open) > + return -ENODEV; > + > + return file->f_op->open(inode, file); > } > > MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR);