drm/amdgpu/debugfs: fix error code when smc register accessors are NULL
Subsystems (2)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu/debugfs: fix error code when smc register accessors are NULL
Should be -EOPNOTSUPP.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -2
@@ -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 ;
Signature · 1 line
2.42.0
Alex Deucher
maintainerPATCH 2/2 drm/amdgpu/debugfs: check if pcie register callbacks are valid
Before trying to use them in the debugfs register access functions.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +6 -0
@@ -525,6 +525,9 @@ static ssize_t amdgpu_debugfs_regs_pcie_read(struct file *f, char __user *buf,if (size &0x3 || *pos &0x3 )return -EINVAL ; +if (!adev->pcie_rreg) +return -EOPNOTSUPP ; + r =pm_runtime_get_sync (adev_to_drm (adev)->dev);if (r <0 ) {pm_runtime_put_autosuspend (adev_to_drm (adev)->dev);
@@ -581,6 +584,9 @@ static ssize_t amdgpu_debugfs_regs_pcie_write(struct file *f, const char __userif (size &0x3 || *pos &0x3 )return -EINVAL ; +if (!adev->pcie_wreg) +return -EOPNOTSUPP ; + r =pm_runtime_get_sync (adev_to_drm (adev)->dev);if (r <0 ) {pm_runtime_put_autosuspend (adev_to_drm (adev)->dev);
Signature · 1 line
2.42.0
Ping on this series?
Alex
Quoted 34 lines · Alex Deucher
Should be
-EOPNOTSUPP.Fixes 5104fdf50d32 ("drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL")Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2
-3@@ -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 ; --2.42.0
The second patch never made it into my inbox, but the first one is Reviewed-by: Christian König <[email protected]>.
Christian.
Am 07.12.23 um 18:39 schrieb Alex Deucher:
Quoted 38 lines
Ping on this series?
Alex
Quoted 33 lines · Alex Deucher
Should be
-EOPNOTSUPP.Fixes 5104fdf50d32 ("drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL")Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2
-3@@ -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 ; --2.42.0
Quoted 3 lines · Christian König
The second patch never made it into my inbox, but the first one is
Reviewed-by Christian König <[email protected]>.
Thanks. Patch 2:
https://patchwork.freedesktop.org/patch/569132/
Alex
Quoted 43 lines
Christian.
Am 07.12.23 um 18:39 schrieb Alex Deucher:
Quoted 38 lines
Ping on this series?
Alex
Quoted 33 lines · Alex Deucher
Should be
-EOPNOTSUPP.Fixes 5104fdf50d32 ("drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL")Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2
-3@@ -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 ; --2.42.0