diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-11-20 05:14:20 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-12-16 16:45:04 -0500 |
commit | 97cb69dd800a471c3ee2467be3826badd9c12883 (patch) | |
tree | 516f985ee156043e403987da369f9dbc724f467a | |
parent | 9f9499ae8e6415cefc4fe0a96ad0e27864353c89 (diff) |
UBI: fix return error code
We are checking dfs_rootdir for error value or NULL. But in the
conditional ternary operator we returned -ENODEV if dfs_rootdir contains
an error value and returned PTR_ERR(dfs_rootdir) if dfs_rootdir is NULL.
So in the case of dfs_rootdir being NULL we actually assigned 0 to err
and returned it to the caller implying a success.
Lets return -ENODEV when dfs_rootdir is NULL else return
PTR_ERR(dfs_rootdir).
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | drivers/mtd/ubi/debug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index b077e43b5ba9..c4cb15a3098c 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -236,7 +236,7 @@ int ubi_debugfs_init(void) | |||
236 | 236 | ||
237 | dfs_rootdir = debugfs_create_dir("ubi", NULL); | 237 | dfs_rootdir = debugfs_create_dir("ubi", NULL); |
238 | if (IS_ERR_OR_NULL(dfs_rootdir)) { | 238 | if (IS_ERR_OR_NULL(dfs_rootdir)) { |
239 | int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir); | 239 | int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV; |
240 | 240 | ||
241 | pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n", | 241 | pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n", |
242 | err); | 242 | err); |