From patchwork Tue Jan 22 15:21:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10775735 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 B933A1390 for ; Tue, 22 Jan 2019 15:23:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A812428505 for ; Tue, 22 Jan 2019 15:23:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B6E32AEAD; Tue, 22 Jan 2019 15:23:22 +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 1E18F28505 for ; Tue, 22 Jan 2019 15:23:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 210978E0005; Tue, 22 Jan 2019 10:23:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1BFF18E0001; Tue, 22 Jan 2019 10:23:21 -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 0AEA18E0005; Tue, 22 Jan 2019 10:23:21 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id C0C738E0001 for ; Tue, 22 Jan 2019 10:23:20 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id r13so16656263pgb.7 for ; Tue, 22 Jan 2019 07:23:20 -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=EFEUynTyOgM8QRt34wAZvtkabWTzKD2W96Q/+9DNpZM=; b=qHNj7DuTjlk1IXX56Li+jm46QlKeFrzmD7eSEe9IURqHgAcHUzUrpK31KbFlbF2/fS QeujdXPzEByaljDBgnyOqXEWAyNajzHSpO6+TkD4wj3gthFzokYAKATIzVkox6IW6HkJ 23lNdNEvJK2HGVuWjBpGrSNdh6/QWe1hOnP3HPgSs/UDWZKJ3tMAzvsyyN5DZKjcBk++ FBl3qfItUIG8nAQyd6c5PDHBr+B/P4mzOe0213moBneFBGH0Evn7wYiusYs1BbeJkWDc N02EFQaS464GFtdRlA8teYFXsgaVuh0hmEzU6y9K3y6xFLiim+4HmXvX7P/DzDoQMznt pmSw== X-Gm-Message-State: AJcUukcQIikkitjnX8YXkN0Mh6xZHQFKEm/PeQg2lntfkQ8HWJnrFqB4 FpsGt/5FkGDMsblEUsoRxMNzEZU+sVrp9iUYPYWUq3+haHKOL7YPuwsk5MBo/8aVaj4zgZmBTRY POWm1STAF8Jb/k0rViVXLWDpFHlHwTySteTbqRiLS0t2Xn7bVDUuQtuz8R/cZua4= X-Received: by 2002:a17:902:76cb:: with SMTP id j11mr35375857plt.179.1548170600369; Tue, 22 Jan 2019 07:23:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN6badNWCUYOkzi64wof5KLF3LrwWI7XeNFIU/pZG+AmIdODRsn7ekPX4r0X1ZTG5Bq29rm5 X-Received: by 2002:a17:902:76cb:: with SMTP id j11mr35375815plt.179.1548170599165; Tue, 22 Jan 2019 07:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548170599; cv=none; d=google.com; s=arc-20160816; b=0WsuSL533PACS2xxqmwn0EmCkj31BSATUytvWO34KnYlHCIS21u096Mno7ArSoLPTu 57W5D321f4EbeAFqhy4+QB5jBQxfS6Q5Z8/4NGVzuiVRcCZea7ZpYTUAegeekmr1AqYc 8lX4/dYMg8BEbYsST7d5Wist2DCFa3YTcnotsPFpW11XPhqZbSTA96rq7bghELyoGMmj BZT9PjIO7iOvEKWRblO5ZYnTB2YK6hBtgP7orWXleXCNRV+yzqNvPasq9wae14mQAiLu 6ABJlwdMTWgktlm7n6nq7CetOk9rpZC7ZWw2BBpgdNmIp/gnOpVrSrJYJl1Jo7ZrJNiA waRA== 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=EFEUynTyOgM8QRt34wAZvtkabWTzKD2W96Q/+9DNpZM=; b=Gs/JuvnRnKgfByiCT0vxbeB63Bq6UOTCDMFUO1QJd2dJGCBpGPcJ0U4AIG5/8Ma9dc fS6hbXaYdi/wcedW7zJKHLTyXe3/+6wmzacCBqjZdkxiCrYwJP/iI4QGlu3Mat72xSMm 03pG7L0kELpzD34oYBbmbSZIwRtCucgfXHU48Cr5fTcOoNbqMSvYeZgEPY522v4R3/XA DkdLHYBHofwDNc8AcWU+oNfNEgawSG225mWnLnWNI0EllCbiG85jSFdOv6yCiGYQZsHx am7zv4uQ4VETvlBYXTrrhnsPlXqoJyfel44HErGP6Gk/aEdj9MTulZlsFhU0XWp++UY6 Bb9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ap82X8rV; 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 w6si14892048pfb.191.2019.01.22.07.23.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 07:23:19 -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=Ap82X8rV; 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 5C7E120879; Tue, 22 Jan 2019 15:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548170598; bh=UEB610lHpX8IzbMk+K0D+wlmM2n52roj5Owc+Pu0IR0=; h=From:To:Cc:Subject:Date:From; b=Ap82X8rVHQUInznQSBGMl+rOv/9D3RTuzrf0mNOnoe/+/x9XOZ+9V7sQ+wy+7vLbJ vOFDLMoG26dDpE21b+jVZHAsdx9JDrvKd91Qlfu/wfWlwf/Px+4Yy17ZzheHCH1HyY cEawlMcTn2hKC8gRE/au4pCrE8CR66AyBTsy8ZAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Andrew Morton , Anders Roxell , Arnd Bergmann , Sebastian Andrzej Siewior , Michal Hocko , linux-mm@kvack.org Subject: [PATCH] backing-dev: no need to check return value of debugfs_create functions Date: Tue, 22 Jan 2019 16:21:07 +0100 Message-Id: <20190122152151.16139-8-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. And as the return value does not matter at all, no need to save the dentry in struct backing_dev_info, so delete it. Cc: Andrew Morton Cc: Anders Roxell Cc: Arnd Bergmann Cc: Sebastian Andrzej Siewior Cc: Michal Hocko Cc: linux-mm@kvack.org Signed-off-by: Greg Kroah-Hartman Reviewed-by: Sebastian Andrzej Siewior --- include/linux/backing-dev-defs.h | 1 - mm/backing-dev.c | 24 +++++------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index c31157135598..7f64d813580b 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -202,7 +202,6 @@ struct backing_dev_info { #ifdef CONFIG_DEBUG_FS struct dentry *debug_dir; - struct dentry *debug_stats; #endif }; diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 8a8bb8796c6c..85ef344a9c67 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -102,39 +102,25 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) } DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats); -static int bdi_debug_register(struct backing_dev_info *bdi, const char *name) +static void bdi_debug_register(struct backing_dev_info *bdi, const char *name) { - if (!bdi_debug_root) - return -ENOMEM; - bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root); - if (!bdi->debug_dir) - return -ENOMEM; - - bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir, - bdi, &bdi_debug_stats_fops); - if (!bdi->debug_stats) { - debugfs_remove(bdi->debug_dir); - bdi->debug_dir = NULL; - return -ENOMEM; - } - return 0; + debugfs_create_file("stats", 0444, bdi->debug_dir, bdi, + &bdi_debug_stats_fops); } static void bdi_debug_unregister(struct backing_dev_info *bdi) { - debugfs_remove(bdi->debug_stats); - debugfs_remove(bdi->debug_dir); + debugfs_remove_recursive(bdi->debug_dir); } #else static inline void bdi_debug_init(void) { } -static inline int bdi_debug_register(struct backing_dev_info *bdi, +static inline void bdi_debug_register(struct backing_dev_info *bdi, const char *name) { - return 0; } static inline void bdi_debug_unregister(struct backing_dev_info *bdi) {