]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/amdgpu/debugfs: fix error code when smc register accessors are NULL
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Nov 2023 22:26:29 +0000 (17:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 14 Dec 2023 20:27:42 +0000 (15:27 -0500)
Should be -EOPNOTSUPP.

Fixes: 5104fdf50d32 ("drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

index 424bed7382965f23583b52930acc861b88705546..2cebf2145d9a6e726357a89924963cab461d740e 100644 (file)
@@ -755,7 +755,7 @@ static ssize_t amdgpu_debugfs_regs_smc_read(struct file *f, char __user *buf,
        int r;
 
        if (!adev->smc_rreg)
-               return -EPERM;
+               return -EOPNOTSUPP;
 
        if (size & 0x3 || *pos & 0x3)
                return -EINVAL;
@@ -814,7 +814,7 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user *
        int r;
 
        if (!adev->smc_wreg)
-               return -EPERM;
+               return -EOPNOTSUPP;
 
        if (size & 0x3 || *pos & 0x3)
                return -EINVAL;