[PATCH 1/2] drm/amdgpu: use IS_ERR for debugfs APIs

Das, Nirmoy nirmoy.das at amd.com
Fri Sep 3 08:13:38 UTC 2021


Hi Christian and Shashank,


Please review the v2 : https://patchwork.freedesktop.org/patch/452175/

In v2, I am returning "PTR_ERR(ent)" instead of -EIO which I think makes more sense.

Regards,
Nirmoy

On 9/3/2021 9:53 AM, Christian König wrote:
> Am 02.09.21 um 13:44 schrieb Nirmoy Das:
>> debugfs APIs returns encoded error so use
>> IS_ERR for checking return value.
>>
>> References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
>> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++----
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 2 +-
>>   2 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> index d256215ab2c7..077f9baf74fe 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> @@ -1696,18 +1696,16 @@ int amdgpu_debugfs_init(struct amdgpu_device 
>> *adev)
>>       struct dentry *ent;
>>       int r, i;
>>   -
>> -
>>       ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
>>                     &fops_ib_preempt);
>> -    if (!ent) {
>> +    if (IS_ERR(ent)) {
>>           DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs 
>> file\n");
>>           return -EIO;
>>       }
>>         ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
>>                     &fops_sclk_set);
>> -    if (!ent) {
>> +    if (IS_ERR(ent)) {
>>           DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
>>           return -EIO;
>>       }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> index 7b634a1517f9..f40753e1a60d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> @@ -428,7 +428,7 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device 
>> *adev,
>>       ent = debugfs_create_file(name,
>>                     S_IFREG | S_IRUGO, root,
>>                     ring, &amdgpu_debugfs_ring_fops);
>> -    if (!ent)
>> +    if (IS_ERR(ent))
>>           return -ENOMEM;
>>         i_size_write(ent->d_inode, ring->ring_size + 12);
>


More information about the amd-gfx mailing list