Commit afcdb8e5 authored by Lv Ruyi's avatar Lv Ruyi Committed by Thierry Reding

firmware: tegra: Fix error check return value of debugfs_create_file()

If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
so use IS_ERR() to check it.
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarLv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent a4740b14
...@@ -474,7 +474,7 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp, ...@@ -474,7 +474,7 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp,
mode |= attrs & DEBUGFS_S_IWUSR ? 0200 : 0; mode |= attrs & DEBUGFS_S_IWUSR ? 0200 : 0;
dentry = debugfs_create_file(name, mode, parent, bpmp, dentry = debugfs_create_file(name, mode, parent, bpmp,
&bpmp_debug_fops); &bpmp_debug_fops);
if (!dentry) { if (IS_ERR(dentry)) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
...@@ -725,7 +725,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, ...@@ -725,7 +725,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf,
if (t & DEBUGFS_S_ISDIR) { if (t & DEBUGFS_S_ISDIR) {
dentry = debugfs_create_dir(name, parent); dentry = debugfs_create_dir(name, parent);
if (!dentry) if (IS_ERR(dentry))
return -ENOMEM; return -ENOMEM;
err = bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); err = bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1);
if (err < 0) if (err < 0)
...@@ -738,7 +738,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, ...@@ -738,7 +738,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf,
dentry = debugfs_create_file(name, mode, dentry = debugfs_create_file(name, mode,
parent, bpmp, parent, bpmp,
&debugfs_fops); &debugfs_fops);
if (!dentry) if (IS_ERR(dentry))
return -ENOMEM; return -ENOMEM;
} }
} }
...@@ -788,11 +788,11 @@ int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp) ...@@ -788,11 +788,11 @@ int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp)
return 0; return 0;
root = debugfs_create_dir("bpmp", NULL); root = debugfs_create_dir("bpmp", NULL);
if (!root) if (IS_ERR(root))
return -ENOMEM; return -ENOMEM;
bpmp->debugfs_mirror = debugfs_create_dir("debug", root); bpmp->debugfs_mirror = debugfs_create_dir("debug", root);
if (!bpmp->debugfs_mirror) { if (IS_ERR(bpmp->debugfs_mirror)) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment