From patchwork Wed Mar 23 09:51:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Carmody X-Patchwork-Id: 88061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F31501007D1 for ; Wed, 23 Mar 2011 20:57:56 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q2KnW-0001Fh-S7; Wed, 23 Mar 2011 09:56:15 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q2KnT-0005bZ-Pt; Wed, 23 Mar 2011 09:56:11 +0000 Received: from smtp.nokia.com ([147.243.128.24] helo=mgw-da01.nokia.com) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q2KnP-0005bG-Cw for linux-mtd@lists.infradead.org; Wed, 23 Mar 2011 09:56:08 +0000 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da01.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p2N9u2SM025102; Wed, 23 Mar 2011 11:56:02 +0200 Received: from localhost ([ucofw-nat2.nokia.com [131.228.1.90]]) by mgw-da01.nokia.com with RELAY id p2N9tWZn024305 ; Wed, 23 Mar 2011 11:55:33 +0200 From: Phil Carmody To: dedekind1@gmail.com Subject: [PATCH 1/1] ubifs: debugfs operations may return both ERRs and NULLs Date: Wed, 23 Mar 2011 11:51:29 +0200 Message-Id: <1300873889-18336-1-git-send-email-ext-phil.2.carmody@nokia.com> X-Mailer: git-send-email 1.7.2.rc1.37.gf8c40 X-Nokia-AV: Clean X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110323_055607_636502_0A95379C X-CRM114-Status: GOOD ( 10.92 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_SPACE_BRACKET TVD_RCVD_SPACE_BRACKET -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [147.243.128.24 listed in list.dnswl.org] Cc: linux-mtd@lists.infradead.org, adrian.hunter@nokia.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org I knew I invented IS_ERR_OR_NULL for something, and this was probably it. NULL has lost all information about what the error was, and the most appropriate error code is ENODEV. However, that's the only error code that the debugfs functions can return. So basically, any error = ENODEV. Signed-off-by: Phil Carmody --- fs/ubifs/debug.c | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index dbc093a..7b41b30 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -2578,11 +2578,10 @@ static struct dentry *dfs_rootdir; int dbg_debugfs_init(void) { dfs_rootdir = debugfs_create_dir("ubifs", NULL); - if (IS_ERR(dfs_rootdir)) { - int err = PTR_ERR(dfs_rootdir); + if (IS_ERR_OR_NULL(dfs_rootdir)) { ubifs_err("cannot create \"ubifs\" debugfs directory, " - "error %d\n", err); - return err; + "error %d\n", PTR_ERR(dfs_rootdir)); + return -ENODEV; } return 0; @@ -2645,47 +2644,44 @@ static const struct file_operations dfs_fops = { */ int dbg_debugfs_init_fs(struct ubifs_info *c) { - int err; const char *fname; struct dentry *dent; struct ubifs_debug_info *d = c->dbg; sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir); - if (IS_ERR(d->dfs_dir)) { - err = PTR_ERR(d->dfs_dir); + if (IS_ERR_OR_NULL(d->dfs_dir)) { ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", - d->dfs_dir_name, err); + d->dfs_dir_name, PTR_ERR(d->dfs_rootdir)); goto out; } fname = "dump_lprops"; dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); - if (IS_ERR(dent)) + if (IS_ERR_OR_NULL(dent)) goto out_remove; d->dfs_dump_lprops = dent; fname = "dump_budg"; dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); - if (IS_ERR(dent)) + if (IS_ERR_OR_NULL(dent)) goto out_remove; d->dfs_dump_budg = dent; fname = "dump_tnc"; dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops); - if (IS_ERR(dent)) + if (IS_ERR_OR_NULL(dent)) goto out_remove; d->dfs_dump_tnc = dent; return 0; out_remove: - err = PTR_ERR(dent); ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", - fname, err); + fname, PTR_ERR(dent)); debugfs_remove_recursive(d->dfs_dir); out: - return err; + return -ENODEV; } /**