From patchwork Tue Jan 22 15:21:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10775719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3BD61399 for ; Tue, 22 Jan 2019 15:22:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1CF82AFEA for ; Tue, 22 Jan 2019 15:22:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C33F72AFDF; Tue, 22 Jan 2019 15:22:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6937C2AFE1 for ; Tue, 22 Jan 2019 15:22:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A70D8E0005; Tue, 22 Jan 2019 10:22:07 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 654138E0001; Tue, 22 Jan 2019 10:22:07 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 569E78E0005; Tue, 22 Jan 2019 10:22:07 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 167F68E0001 for ; Tue, 22 Jan 2019 10:22:07 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id r13so16654521pgb.7 for ; Tue, 22 Jan 2019 07:22:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:mime-version:content-transfer-encoding; bh=W91Bhhhwa++JjsVDkbqMhHFJ99Gtza+Wq17z+/AWTO4=; b=FJGMv4x+b9jXKbh4a4OsL5iINy0z27qXNTYvLJC9KT8c6ToMn8aCpwSt9CXVV7dleW Ablm/gXIDK+vpSNYwWttLWD1YMNi5h0FfIvO9xD+ixwhII0E/Iv222brVVtl1M/7vH1q 0TTdL7yWrQUBB5/QpQOI87GcEJULESYVg2TeI9gIoZrtmJhr5ac3zILAbqkerD5KBXkd lfEinoQXVHY2UrzDZBcyeFASJ6awv5ikuTh4H8tfYBpLq/mniWHtDId1rK9lRdrMskjP 8NbFrNlakiw3fBOJDqHF8creCCU+DNmubnVVDDnHztoNsTBaavTTj+NEb/k/23/TWKRe SDtw== X-Gm-Message-State: AJcUukdZxIUNFHoQNB8AfrELoNrNXAIuAzzYOmQLVhX99/WywEZIlGoP SmeQuydCcWYxSNxIucD8JwyjzivF0TJfvD5QIT3KmFNGl0E6yUrYlcTV8AaEo2uCtdd/GP89EzP PECOuJngqJpGhw7KLJIhMc3EDFlET6cSBZqx7WapJrHbxmnKmb1qME7ZuydaoGyE= X-Received: by 2002:a63:4342:: with SMTP id q63mr32389056pga.63.1548170526620; Tue, 22 Jan 2019 07:22:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN4BMUZw+zmTmI3pIlakQYS2RS84EbEFzSW57Lm5LoIuH8VjkEPiNWABlz3PJ+k9r9wje59s X-Received: by 2002:a63:4342:: with SMTP id q63mr32389019pga.63.1548170525911; Tue, 22 Jan 2019 07:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548170525; cv=none; d=google.com; s=arc-20160816; b=tRKCH39JH6t11RRqApiqXGatR2sSWHO1JGj4/uU351R/JeEPEEy/JZOD9u1plgcs/Q 0TxIFd6Aq44P8VQ/Rpr0kPVzSjinA0Pch4X3GRia48biwqy0K1aNpKsGY1WsYxnG60s2 b0lvP3ta5Ij1CD7ESsuU7QxB02bFjME9t4DMjIDa8GinZJW5oteo8Qal2Ova72ckp8/3 tux/b7wGdQHfV/bilR8VYV00LeHlvrczoRdROM/qtMjoLzTHc2tJ/58JtVKEDZ1Jz1A3 /UL5WnGU71Pj+MVvFPv77BBqJod8YuVmsw/zyIaJtdLqVsrS/7BsU3ltqfzcJukR6f7i zqRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=W91Bhhhwa++JjsVDkbqMhHFJ99Gtza+Wq17z+/AWTO4=; b=VYOu7R4F9NWmaAyyG+fuzqxk4sHIbF8Frft505Fl3J95jtwrYd/QhQtyqgzxMKtsWU QB2Ykgx6SzqJjij6WUbd7FkIFOh3XfxEm+GDOOvUxevT8Sa86UdoYddeBb0sLxzKLfuC meXT+Vhp3zs+6ppKQBHRmDH+gef2zBYLVSsUXhNzDrWMETAt1+7Y8HuaOUj9bCPE08p3 m2MFqZKXRp66eDPvqlvGAV7sz1/7kMeFcp8QUUdhmNvFBMzpSuo0/6Vj6K3toIZcUVyK OrQlNPHvcSEYRDjrKGOj+oP+fkbQJrXZGkcTGwrqopv9AE8LTpgSbtFWP/RwGveZrVfN OLQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CaWmaZns; spf=pass (google.com: domain of srs0=915k=p6=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom="SRS0=915k=P6=linuxfoundation.org=gregkh@kernel.org" Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id f10si16684732pln.289.2019.01.22.07.22.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 07:22:05 -0800 (PST) Received-SPF: pass (google.com: domain of srs0=915k=p6=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) client-ip=198.145.29.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CaWmaZns; spf=pass (google.com: domain of srs0=915k=p6=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom="SRS0=915k=P6=linuxfoundation.org=gregkh@kernel.org" 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 1E7C9217D4; Tue, 22 Jan 2019 15:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548170525; bh=nR1J8d5LtNfO/mqoIHCKhucG3tVtxmXGKdRWuUFm+yk=; h=From:To:Cc:Subject:Date:From; b=CaWmaZnsDgZzY7IvRRAVYw3uqaqOl8RPjW+JbSy3FFfAnxXTxh7xfnGx6m9v6aUH0 XdWfo3e8zH1Y/JY7fhHM7F+jHn7xfX/9SGv+Z73VpWIhXoR05UAuQYdRmGTVli9Ob6 i9CzYkhceLnUN3MFyNi7VxE/wLInctXTNFH87e6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Naoya Horiguchi , linux-mm@kvack.org Subject: [PATCH] hwpoison-inject: no need to check return value of debugfs_create functions Date: Tue, 22 Jan 2019 16:21:10 +0100 Message-Id: <20190122152151.16139-11-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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: Naoya Horiguchi Cc: linux-mm@kvack.org Signed-off-by: Greg Kroah-Hartman --- mm/hwpoison-inject.c | 67 +++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index b6ac70616c32..36662d0097d5 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c @@ -76,63 +76,40 @@ static void pfn_inject_exit(void) static int pfn_inject_init(void) { - struct dentry *dentry; - hwpoison_dir = debugfs_create_dir("hwpoison", NULL); - if (hwpoison_dir == NULL) - return -ENOMEM; /* * Note that the below poison/unpoison interfaces do not involve * hardware status change, hence do not require hardware support. * They are mainly for testing hwpoison in software level. */ - dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, - NULL, &hwpoison_fops); - if (!dentry) - goto fail; - - dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, - NULL, &unpoison_fops); - if (!dentry) - goto fail; - - dentry = debugfs_create_u32("corrupt-filter-enable", 0600, - hwpoison_dir, &hwpoison_filter_enable); - if (!dentry) - goto fail; - - dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, - hwpoison_dir, &hwpoison_filter_dev_major); - if (!dentry) - goto fail; - - dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600, - hwpoison_dir, &hwpoison_filter_dev_minor); - if (!dentry) - goto fail; - - dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600, - hwpoison_dir, &hwpoison_filter_flags_mask); - if (!dentry) - goto fail; - - dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600, - hwpoison_dir, &hwpoison_filter_flags_value); - if (!dentry) - goto fail; + debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, NULL, + &hwpoison_fops); + + debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, NULL, + &unpoison_fops); + + debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir, + &hwpoison_filter_enable); + + debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir, + &hwpoison_filter_dev_major); + + debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir, + &hwpoison_filter_dev_minor); + + debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir, + &hwpoison_filter_flags_mask); + + debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir, + &hwpoison_filter_flags_value); #ifdef CONFIG_MEMCG - dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, - hwpoison_dir, &hwpoison_filter_memcg); - if (!dentry) - goto fail; + debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir, + &hwpoison_filter_memcg); #endif return 0; -fail: - pfn_inject_exit(); - return -ENOMEM; } module_init(pfn_inject_init);