Re: [PATCH -next] drm/amdgpu: fix return value check in amdgpu_debugfs_regs_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 19.07.2016 um 14:14 schrieb Wei Yongjun:
From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

In case of error, the function debugfs_create_*() returns NULL
pointer not ERR_PTR() if debugfs is enabled. The IS_ERR() test
in the return value check should be replaced with NULL test.
(defined(CONFIG_DEBUG_FS) make sure debugfs is enabled)

Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx>.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 614fb02..0c992d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2530,12 +2530,12 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
  		ent = debugfs_create_file(debugfs_regs_names[i],
  					  S_IFREG | S_IRUGO, root,
  					  adev, debugfs_regs[i]);
-		if (IS_ERR(ent)) {
+		if (!ent) {
  			for (j = 0; j < i; j++) {
  				debugfs_remove(adev->debugfs_regs[i]);
  				adev->debugfs_regs[i] = NULL;
  			}
-			return PTR_ERR(ent);
+			return -ENOMEM;
  		}
if (!i)



_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux