Skip to content

Commit

Permalink
UBI: fix return error code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sudip Mukherjee authored and Richard Weinberger committed Dec 16, 2015
1 parent 9f9499a commit 97cb69d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/ubi/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n",
err);
Expand Down

0 comments on commit 97cb69d

Please sign in to comment.