Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7497376imu; Tue, 22 Jan 2019 07:01:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6q1K5K1uV17taTJ7ijW4mxT+WbKBGa5bcpe4uPFq85aYiAsevs4dpgaZDZ5UTWv7wyu75d X-Received: by 2002:a63:2054:: with SMTP id r20mr31992947pgm.328.1548169283346; Tue, 22 Jan 2019 07:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548169283; cv=none; d=google.com; s=arc-20160816; b=lfdazgNhibgwgtGa+fJc2VXwGXrs+iLm8iAZhR6JvGF3pHJA/4spsZao6xJGPO+sUj 9uhMJs52mDHmPZMyEqQFiV768fvjcVxQAZYpKlcVdYG7DWxnmy3RuGxBoKc0ruqxzT2y zynn46ec/MQYrsv0Ub5K+cNU++xyJvaW/O9dvtmYymxE3fT1gGAD5DiNCBPMXrAstFR6 HqmObPPPZXoUdBaIc+ywffP8rnk+DaRBzlKMwWOM/i9fMK46RDxHiPudyPMQTGCTaY3Z hTu2df3+XnuLYbn7VVkhGkAo8YSNK977b4/YdloRZHM3TV5ymXvF+vf0c8oTw0HXeZOa Z/vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RE5QMXz8+d6zRrCJc2ueSKwPy0d5IN5E8CRFNkerPeY=; b=kvE0rhfwLjG6LCOA2nyq4W14Tq0vTs2q8EjrCZkLNpDPWF0iRE7/m5DL32uCyaGpPi iN2BHJWWeUU9CPYIxgPBSnE4uz19yYNsyPt+JYfggbG27HQUHMcl48HsU6Svig10/18Z qePviaOhbNt4nj1NFqgSS36IZk1XBMb2UWXjysd1xegfwTMh7NRUBfbpEqkcAl8xtBPt RIH7kcFvr2EKr/gQAayvjYVyYy9ElYEq2vJP+IINcCKxJUr0DfDf57uJzigG9NAacNOQ iLLEEk71xc1t/3YcRf+lCJYRLr9A8L0v8P8L37AgmZW7J2FF0XnFDcQAtk4sT1y4V6D3 DQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F88YiGUb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k135si15728052pgc.574.2019.01.22.07.01.02; Tue, 22 Jan 2019 07:01:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F88YiGUb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729104AbfAVO6i (ORCPT + 99 others); Tue, 22 Jan 2019 09:58:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:38080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728947AbfAVO6h (ORCPT ); Tue, 22 Jan 2019 09:58:37 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 829AE20870; Tue, 22 Jan 2019 14:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548169115; bh=JssKERfluoLL++cBKjL1JZ7jtOSY5IhfmHDS3c2NyJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F88YiGUbuIDkcV5OMBNeMrExBnB6xxQzwEbEVgLUSXe27xiuUa6i9qRmyk7zEshEQ oSz+r4vROOd1cws4EZY3RdEXmxQ66h+0X8vdVAOXvXrnYms6X+WSglgttShKnY0V94 LUhrWQequzXQV78riAMIuTTxfGJbXj8uhZBHAYp4= From: Greg Kroah-Hartman To: Ralf Baechle , Paul Burton , James Hogan , John Crispin Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Greg Kroah-Hartman , Yangtao Li , Andrew Morton , Mike Rapoport , Mathieu Malaterre , Huacai Chen , Marcin Nowakowski , Yasha Cherikovsky Subject: [PATCH 5/5] mips: kernel: no need to check return value of debugfs_create functions Date: Tue, 22 Jan 2019 15:57:42 +0100 Message-Id: <20190122145742.11292-6-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190122145742.11292-1-gregkh@linuxfoundation.org> References: <20190122145742.11292-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan Cc: Yangtao Li Cc: Andrew Morton Cc: Mike Rapoport Cc: Mathieu Malaterre Cc: Huacai Chen Cc: Marcin Nowakowski Cc: Yasha Cherikovsky Cc: linux-mips@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/mips-r2-to-r6-emul.c | 21 ++++----------------- arch/mips/kernel/segment.c | 15 +++------------ arch/mips/kernel/setup.c | 7 +------ arch/mips/kernel/spinlock_test.c | 21 ++++----------------- arch/mips/kernel/unaligned.c | 16 ++++------------ 5 files changed, 16 insertions(+), 64 deletions(-) diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c index c50c89a978f1..b4d210bfcdae 100644 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c @@ -2351,23 +2351,10 @@ DEFINE_SHOW_ATTRIBUTE(mipsr2_clear); static int __init mipsr2_init_debugfs(void) { - struct dentry *mipsr2_emul; - - if (!mips_debugfs_dir) - return -ENODEV; - - mipsr2_emul = debugfs_create_file("r2_emul_stats", S_IRUGO, - mips_debugfs_dir, NULL, - &mipsr2_emul_fops); - if (!mipsr2_emul) - return -ENOMEM; - - mipsr2_emul = debugfs_create_file("r2_emul_stats_clear", S_IRUGO, - mips_debugfs_dir, NULL, - &mipsr2_clear_fops); - if (!mipsr2_emul) - return -ENOMEM; - + debugfs_create_file("r2_emul_stats", S_IRUGO, mips_debugfs_dir, NULL, + &mipsr2_emul_fops); + debugfs_create_file("r2_emul_stats_clear", S_IRUGO, mips_debugfs_dir, + NULL, &mipsr2_clear_fops); return 0; } diff --git a/arch/mips/kernel/segment.c b/arch/mips/kernel/segment.c index 2703f218202e..0a9bd7b0983b 100644 --- a/arch/mips/kernel/segment.c +++ b/arch/mips/kernel/segment.c @@ -95,18 +95,9 @@ static const struct file_operations segments_fops = { static int __init segments_info(void) { - struct dentry *segments; - - if (cpu_has_segments) { - if (!mips_debugfs_dir) - return -ENODEV; - - segments = debugfs_create_file("segments", S_IRUGO, - mips_debugfs_dir, NULL, - &segments_fops); - if (!segments) - return -ENOMEM; - } + if (cpu_has_segments) + debugfs_create_file("segments", S_IRUGO, mips_debugfs_dir, NULL, + &segments_fops); return 0; } diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 8c6c48ed786a..44434e50a355 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -1010,12 +1010,7 @@ unsigned long fw_passed_dtb; struct dentry *mips_debugfs_dir; static int __init debugfs_mips(void) { - struct dentry *d; - - d = debugfs_create_dir("mips", NULL); - if (!d) - return -ENOMEM; - mips_debugfs_dir = d; + mips_debugfs_dir = debugfs_create_dir("mips", NULL); return 0; } arch_initcall(debugfs_mips); diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c index eaed550e79a2..ab4e3e1b138d 100644 --- a/arch/mips/kernel/spinlock_test.c +++ b/arch/mips/kernel/spinlock_test.c @@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); static int __init spinlock_test(void) { - struct dentry *d; - - if (!mips_debugfs_dir) - return -ENODEV; - - d = debugfs_create_file("spin_single", S_IRUGO, - mips_debugfs_dir, NULL, - &fops_ss); - if (!d) - return -ENOMEM; - - d = debugfs_create_file("spin_multi", S_IRUGO, - mips_debugfs_dir, NULL, - &fops_multi); - if (!d) - return -ENOMEM; - + debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, + &fops_ss); + debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, + &fops_multi); return 0; } device_initcall(spinlock_test); diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index 595ca9c85111..0ed20a64b285 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c @@ -2374,18 +2374,10 @@ asmlinkage void do_ade(struct pt_regs *regs) #ifdef CONFIG_DEBUG_FS static int __init debugfs_unaligned(void) { - struct dentry *d; - - if (!mips_debugfs_dir) - return -ENODEV; - d = debugfs_create_u32("unaligned_instructions", S_IRUGO, - mips_debugfs_dir, &unaligned_instructions); - if (!d) - return -ENOMEM; - d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, - mips_debugfs_dir, &unaligned_action); - if (!d) - return -ENOMEM; + debugfs_create_u32("unaligned_instructions", S_IRUGO, mips_debugfs_dir, + &unaligned_instructions); + debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR, + mips_debugfs_dir, &unaligned_action); return 0; } arch_initcall(debugfs_unaligned); -- 2.20.1