All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ubifs: debugfs operations may return both ERRs and NULLs
@ 2011-03-23  9:51 Phil Carmody
  2011-03-23 12:41 ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Carmody @ 2011-03-23  9:51 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd, adrian.hunter

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 <ext-phil.2.carmody@nokia.com>
---
 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;
 }
 
 /**
-- 
1.7.2.rc1.37.gf8c40

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-28 12:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23  9:51 [PATCH 1/1] ubifs: debugfs operations may return both ERRs and NULLs Phil Carmody
2011-03-23 12:41 ` Artem Bityutskiy
2011-03-23 13:16   ` Phil Carmody
2011-03-23 13:35     ` Phil Carmody
2011-03-28  6:51       ` Artem Bityutskiy
2011-03-28 10:38         ` Phil Carmody
2011-03-28 12:10           ` Artem Bityutskiy
2011-03-23 13:18   ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.