@@ -248,11 +248,9 @@ static void dfs_create_fault_entry(struct dentry *parent)
struct dentry *dir;
dir = debugfs_create_dir("fault_inject", parent);
- if (IS_ERR_OR_NULL(dir)) {
- int err = dir ? PTR_ERR(dir) : -ENODEV;
-
+ if (IS_ERR(dir)) {
pr_warn("UBI error: cannot create \"fault_inject\" debugfs directory, error %d\n",
- err);
+ (int)PTR_ERR(dir));
return;
}
@@ -299,11 +297,9 @@ void ubi_debugfs_init(void)
return;
dfs_rootdir = debugfs_create_dir("ubi", NULL);
- if (IS_ERR_OR_NULL(dfs_rootdir)) {
- int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV;
-
+ if (IS_ERR(dfs_rootdir)) {
pr_warn("UBI error: cannot create \"ubi\" debugfs directory, error %d\n",
- err);
+ (int)PTR_ERR(dfs_rootdir));
return;
}
Function debugfs_create_dir will return error pointer rather than NULL if it fails, replace IS_ERR_OR_NULL with IS_ERR just like other places (eg. fault_create_debugfs_attr). Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> --- drivers/mtd/ubi/debug.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)