提交 95169535 编写于 作者: A Artem Bityutskiy

UBIFS: fix error path in dbg_debugfs_init_fs

The debug interface is substandard and on error returns either
NULL or an error code packed in the pointer. So using "IS_ERR"
for the pointers returned by debugfs function is incorrect.
Instead, we should use IS_ERR_OR_NULL.

This path is an improved vestion of the original patch from
Phil Carmody.
Reported-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
上级 cc6a86b9
...@@ -2808,25 +2808,25 @@ int dbg_debugfs_init_fs(struct ubifs_info *c) ...@@ -2808,25 +2808,25 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
fname = d->dfs_dir_name; fname = d->dfs_dir_name;
dent = debugfs_create_dir(fname, dfs_rootdir); dent = debugfs_create_dir(fname, dfs_rootdir);
if (IS_ERR(dent)) if (IS_ERR_OR_NULL(dent))
goto out; goto out;
d->dfs_dir = dent; d->dfs_dir = dent;
fname = "dump_lprops"; fname = "dump_lprops";
dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
if (IS_ERR(dent)) if (IS_ERR_OR_NULL(dent))
goto out_remove; goto out_remove;
d->dfs_dump_lprops = dent; d->dfs_dump_lprops = dent;
fname = "dump_budg"; fname = "dump_budg";
dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
if (IS_ERR(dent)) if (IS_ERR_OR_NULL(dent))
goto out_remove; goto out_remove;
d->dfs_dump_budg = dent; d->dfs_dump_budg = dent;
fname = "dump_tnc"; fname = "dump_tnc";
dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
if (IS_ERR(dent)) if (IS_ERR_OR_NULL(dent))
goto out_remove; goto out_remove;
d->dfs_dump_tnc = dent; d->dfs_dump_tnc = dent;
...@@ -2835,7 +2835,7 @@ int dbg_debugfs_init_fs(struct ubifs_info *c) ...@@ -2835,7 +2835,7 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
out_remove: out_remove:
debugfs_remove_recursive(d->dfs_dir); debugfs_remove_recursive(d->dfs_dir);
out: out:
err = PTR_ERR(dent); err = dent ? PTR_ERR(dent) : -ENODEV;
ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
fname, err); fname, err);
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册