Skip to content

Commit 97cb69d

Browse files
sudipm-mukherjeerichardweinberger
authored andcommitted
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>
1 parent 9f9499a commit 97cb69d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/mtd/ubi/debug.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ int ubi_debugfs_init(void)
236236

237237
dfs_rootdir = debugfs_create_dir("ubi", NULL);
238238
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;
240240

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

0 commit comments

Comments
 (0)