All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	kernel-janitors@vger.kernel.org,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	Akinobu Mita <akinobu.mita@gmail.com>
Subject: [patch] mtd: use correct error codes in debugfs_create()
Date: Fri, 19 Jul 2013 05:49:38 +0000	[thread overview]
Message-ID: <20130719054938.GC9729@elgon.mountain> (raw)

The test here is reversed.  It should be that if "dent" is a valid error
code then we use it, otherwise if it is NULL then use -ENODEV.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 63cb1d7..3916782 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -236,7 +236,7 @@ int ubi_debugfs_init(void)
 
 	dfs_rootdir = debugfs_create_dir("ubi", NULL);
 	if (IS_ERR_OR_NULL(dfs_rootdir)) {
-		int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir);
+		int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV;
 
 		ubi_err("cannot create \"ubi\" debugfs directory, error %d\n",
 			err);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index cb38f3d..f06863a 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -530,7 +530,7 @@ static int nandsim_debugfs_create(struct nandsim *dev)
 
 	dent = debugfs_create_dir("nandsim", NULL);
 	if (IS_ERR_OR_NULL(dent)) {
-		int err = dent ? -ENODEV : PTR_ERR(dent);
+		int err = dent ? PTR_ERR(dent) : -ENODEV;
 
 		NS_ERR("cannot create \"nandsim\" debugfs directory, err %d\n",
 			err);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	kernel-janitors@vger.kernel.org,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	Akinobu Mita <akinobu.mita@gmail.com>
Subject: [patch] mtd: use correct error codes in debugfs_create()
Date: Fri, 19 Jul 2013 08:49:38 +0300	[thread overview]
Message-ID: <20130719054938.GC9729@elgon.mountain> (raw)

The test here is reversed.  It should be that if "dent" is a valid error
code then we use it, otherwise if it is NULL then use -ENODEV.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 63cb1d7..3916782 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -236,7 +236,7 @@ int ubi_debugfs_init(void)
 
 	dfs_rootdir = debugfs_create_dir("ubi", NULL);
 	if (IS_ERR_OR_NULL(dfs_rootdir)) {
-		int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir);
+		int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV;
 
 		ubi_err("cannot create \"ubi\" debugfs directory, error %d\n",
 			err);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index cb38f3d..f06863a 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -530,7 +530,7 @@ static int nandsim_debugfs_create(struct nandsim *dev)
 
 	dent = debugfs_create_dir("nandsim", NULL);
 	if (IS_ERR_OR_NULL(dent)) {
-		int err = dent ? -ENODEV : PTR_ERR(dent);
+		int err = dent ? PTR_ERR(dent) : -ENODEV;
 
 		NS_ERR("cannot create \"nandsim\" debugfs directory, err %d\n",
 			err);

             reply	other threads:[~2013-07-19  5:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  5:49 Dan Carpenter [this message]
2013-07-19  5:49 ` [patch] mtd: use correct error codes in debugfs_create() Dan Carpenter
2013-07-22  5:56 ` Dan Carpenter
2013-07-22  5:56   ` Dan Carpenter
2013-07-22  7:51   ` walter harms
2013-07-22  7:51     ` walter harms
2013-07-22 12:47     ` Dan Carpenter
2013-07-22 12:47       ` Dan Carpenter
2013-07-22 20:43 ` [patch v2] mtd: tiny debugfs related fixes Dan Carpenter
2013-07-22 20:43   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130719054938.GC9729@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=akinobu.mita@gmail.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.