drm/amdgpu: use IS_ERR for debugfs APIs

debugfs APIs returns encoded error so use
IS_ERR for checking return value.

v2: return PTR_ERR(ent)

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-By: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
This commit is contained in:
Nirmoy Das 2021-09-02 13:27:56 +02:00 committed by Alex Deucher
parent 7bbee36d71
commit b04ce53eac
2 changed files with 6 additions and 8 deletions

View File

@ -1544,20 +1544,18 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
struct dentry *ent; struct dentry *ent;
int r, i; int r, i;
ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev, ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
&fops_ib_preempt); &fops_ib_preempt);
if (!ent) { if (IS_ERR(ent)) {
DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n"); DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
return -EIO; return PTR_ERR(ent);
} }
ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev, ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
&fops_sclk_set); &fops_sclk_set);
if (!ent) { if (IS_ERR(ent)) {
DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n"); DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
return -EIO; return PTR_ERR(ent);
} }
/* Register debugfs entries for amdgpu_ttm */ /* Register debugfs entries for amdgpu_ttm */

View File

@ -428,8 +428,8 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
ent = debugfs_create_file(name, ent = debugfs_create_file(name,
S_IFREG | S_IRUGO, root, S_IFREG | S_IRUGO, root,
ring, &amdgpu_debugfs_ring_fops); ring, &amdgpu_debugfs_ring_fops);
if (!ent) if (IS_ERR(ent))
return -ENOMEM; return PTR_ERR(ent);
i_size_write(ent->d_inode, ring->ring_size + 12); i_size_write(ent->d_inode, ring->ring_size + 12);
ring->ent = ent; ring->ent = ent;