Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2520095pxm; Mon, 28 Feb 2022 00:14:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJywpVtXSDQB/LzDhHg7dZVzmFLxnSTOo5BfLb8HsHLpY6+6e3a8OWw1ITU0n7ZAIangebul X-Received: by 2002:a17:902:820b:b0:151:3b2e:5c7e with SMTP id x11-20020a170902820b00b001513b2e5c7emr13268403pln.93.1646036084997; Mon, 28 Feb 2022 00:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646036084; cv=none; d=google.com; s=arc-20160816; b=g93g7CyVhL8iKkqU+NE/S6yDegJry+Xv4+JeZlsqhBuMqKziZdgX5rNMA1DT3be3Ki BKtsXsstXKxPBXHSUAdeoOwwZwjEdfPn3EPJXvm2sy2xxyJL9CBdFYG+9hlg+S6PHSNF iwyRZ22HEJ7Ae+p3rpSjSBQ4DmUTMCniZlSUjHx+vq9Sd8Ebwc2Y8+N3YYLBTcC0+M6/ aXQY0pp2rd2GGjGCh48a8MZgAx8bRrdaxLt9WSox1Q0PiqWAwrAZa02k//8mKCnX+QU0 O7R4TIyIg+owJg0tjRPjwWaNIMZkoUNCO/0PNvsryuE6jH/6lKK1JGO4P0CXKD2wdX0a AVaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=eGinZ5qQw6JbR19Zy5UxA8uWnG/I7pNyVDTuc1Pc0B8=; b=H1YzK2PhRWMGJixtg+lOswep1L4l8w67c3wezhi2a5cVbwxEbD5+W9LDC5VqA/JlCb N4owcNsXOmGDvheyqSt8EkFVHFpoAx+5ELf5AEONxyTV7kcl+h3wYvepRj0q2G8CfSBK 3FzVWdg8wcsiGL33UCEHRXgFk9Xg7jjVoRy6m+LPPAONjFazVgKyN9qISdnM5PgCaD6c VnHYb74HjE+mZCno8fnkZy4Ovuj5QisRrumiLbc1kYRxNRKDj/QyMdPqtRYD6xL6D0/d zDQ2eS++0lc2U80AxU9pKACOYuo8VZiPWHDnmNKDGwWXL6kQewQJxRWNa1kplQoneslk +uPQ== 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 j25-20020a635959000000b00378a2926d7fsi2348723pgm.530.2022.02.28.00.14.30; Mon, 28 Feb 2022 00:14:44 -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 S233056AbiB1FBH (ORCPT + 99 others); Mon, 28 Feb 2022 00:01:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbiB1FBF (ORCPT ); Mon, 28 Feb 2022 00:01:05 -0500 Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C3C466FAF for ; Sun, 27 Feb 2022 21:00:26 -0800 (PST) X-QQ-mid: bizesmtp65t1646024415tgb8fz03 Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 28 Feb 2022 13:00:13 +0800 (CST) X-QQ-SSF: 01400000002000C0F000B00A0000000 X-QQ-FEAT: F3yR32iATbiob0GwumxSEecyqtbY2ZSDQEfiAHX9Jy4WUUwlk/vzNs9XabPiU 3sU/gC1KLfAtN0c0h6J/3ARq4Dn6YVqOqRl+78uSQq9JkA0KZIav/4yv62k6ERNm6FbOxLZ 1rfoiLiWAJi0FsF4DQRCK0Z0PalGZUkIFFX4TuMqTa16RvtGEkhxr05v2QPNQ17TapcAH3P ozeKVgqzGszy2SXixvrznqbM6R3hyb5urNIag/uI5RIXrXa1HmbvmhtIbYiIglVW3hhVYjA 3ozIqcMuTXLEfAeitWHjkbhoYJ2orxNvZn+i8Id3iLEZTNoRMXX8Q79CYGlsbN5QuUSMzx0 ZqjXd6XMM3+gmCzjnqiqHJKAbhnNyj/f3rRDndlyq2/LoWKCkg= X-QQ-GoodBg: 2 From: Meng Tang To: perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Meng Tang , JOE Perches Subject: [PATCH v3 2/2] ALSA: core: Remove redundant variable and return the last statement Date: Mon, 28 Feb 2022 13:00:03 +0800 Message-Id: <20220228050003.32509-2-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220228050003.32509-1-tangmeng@uniontech.com> References: <20220228050003.32509-1-tangmeng@uniontech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 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 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 --- 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); -- 2.20.1