Skip to contentSkip to conversation

drm/amdgpu: fix a warning in amdgpu_ras.c

PATCH In review Alex Deucher 3 participants 5 messages Sep 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix a warning in amdgpu_ras.c

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function ‘amdgpu_ras_fs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result [-Wunused-result]

 1284 |  sysfs_create_group(&adev->dev->kobj, &group);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Do we care whether this fails or not?

 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -3
index 49d10330bf64..67724049a0fc 100644
@@ -1281,9 +1281,7 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
 		sysfs_bin_attr_init(bin_attrs[0]);
 	}
 
-	sysfs_create_group(&adev->dev->kobj, &group);
-
-	return 0;
+	return sysfs_create_group(&adev->dev->kobj, &group);
 }
 
 static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)
Signature · 6 lines
2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by Nirmoy Das on v1 1/1
#1 lore raw
Quoted 9 lines · Alex Deucher

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function ‘amdgpu_ras_fs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result [-Wunused-result]

  1284 |  sysfs_create_group(&adev->dev->kobj, &group);
       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Do we care whether this fails or not?

I think we should. Failure in sysfs_create_group() means memory starved

system or we are doing something in the driver code.

IMO in both cases, we should error out.

Nirmoy

Quoted 9 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 49d10330bf64..67724049a0fc 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_fs_init(struct amdgpu_device *adev) · line 1287

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -3
@@ -1281,9 +1281,7 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
  		sysfs_bin_attr_init(bin_attrs[0]);
  	}
 
-	sysfs_create_group(&adev->dev->kobj, &group);
-
-	return 0;
+	return sysfs_create_group(&adev->dev->kobj, &group);
  }
 
  static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 11 lines · Nirmoy
Quoted 8 lines · Alex Deucher

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function ‘amdgpu_ras_fs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result [-Wunused-result]

  1284 |  sysfs_create_group(&adev->dev->kobj, &group);
       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Quoted 8 lines
Quoted 1 line

Do we care whether this fails or not?

I think we should. Failure in sysfs_create_group() means memory starved

system or we are doing something in the driver code.

IMO in both cases, we should error out.

I disagree. We should try to bring up a display as much as possible. sysfs failing shouldn't necessarily bring down the system. The system should be as resilient as possible and try to survive as much as possible.

If indeed we had had a memory starvation, other things would fail, before or after this sequence. And if those things are terminal, which sysfs is not, then let those other errors, such as no memory for BOs, bring the display bring-up down.

Regards,
Luben

Quoted 22 lines

Nirmoy

Quoted 18 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -3
index 49d10330bf64..67724049a0fc 100644
@@ -1281,9 +1281,7 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
  		sysfs_bin_attr_init(bin_attrs[0]);
  	}
 
-	sysfs_create_group(&adev->dev->kobj, &group);
-
-	return 0;
+	return sysfs_create_group(&adev->dev->kobj, &group);
  }
 
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_fs_init(struct amdgpu_device *adev) · line 1287

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
  static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cluben.tuikov%40amd.com%7Cd3a29eb3223b4b58ff6b08d86163c8a9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637366428560245712&sdata=bYWjk2k8IeEolG2wcJLA7J%2Bx2d%2FOSXNIOpLObk%2F3jSQ%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 16 lines · Luben Tuikov
Quoted 15 lines · Nirmoy
Quoted 9 lines · Alex Deucher

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function ‘amdgpu_ras_fs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result [-Wunused-result]

   1284 |  sysfs_create_group(&adev->dev->kobj, &group);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Do we care whether this fails or not?

I think we should. Failure in sysfs_create_group() means memory starved

Quoted 7 lines
Quoted 3 lines

system or we are doing something in the driver code.

IMO in both cases, we should error out.

I disagree. We should try to bring up a display as much as possible. sysfs failing shouldn't necessarily bring down the system. The system should be as resilient as possible and try to survive as much as possible.

True, there is no use of printing error if we can't see that.

Alex,

We should then at least throw a warning and return void in amdgpu_ras_fs_init().

Thanks,

Nirmoy

Quoted 36 lines

If indeed we had had a memory starvation, other things would fail, before or after this sequence. And if those things are terminal, which sysfs is not, then let those other errors, such as no memory for BOs, bring the display bring-up down.

Regards,
Luben

Quoted 26 lines

Nirmoy

Quoted 8 lines
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
   1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 49d10330bf64..67724049a0fc 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_fs_init(struct amdgpu_device *adev) · line 1287

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -3
@@ -1281,9 +1281,7 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
   		sysfs_bin_attr_init(bin_attrs[0]);
   	}
 
-	sysfs_create_group(&adev->dev->kobj, &group);
-
-	return 0;
+	return sysfs_create_group(&adev->dev->kobj, &group);
   }
 
   static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cluben.tuikov%40amd.com%7Cd3a29eb3223b4b58ff6b08d86163c8a9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637366428560245712&sdata=bYWjk2k8IeEolG2wcJLA7J%2Bx2d%2FOSXNIOpLObk%2F3jSQ%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
Quoted 27 lines · Nirmoy
Quoted 16 lines · Luben Tuikov
Quoted 15 lines · Nirmoy
Quoted 9 lines · Alex Deucher

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function ‘amdgpu_ras_fs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of ‘sysfs_create_group’, declared with attribute warn_unused_result [-Wunused-result]

   1284 |  sysfs_create_group(&adev->dev->kobj, &group);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Do we care whether this fails or not?

I think we should. Failure in sysfs_create_group() means memory starved

Quoted 7 lines
Quoted 3 lines

system or we are doing something in the driver code.

IMO in both cases, we should error out.

I disagree. We should try to bring up a display as much as possible. sysfs failing shouldn't necessarily bring down the system. The system should be as resilient as possible and try to survive as much as possible.

Quoted 8 lines

True, there is no use of printing error if we can't see that.

Alex,

We should then at least throw a warning and return void in amdgpu_ras_fs_init().

I think Alex knows what the best course of action is, after my email. Plus we'll get a chance to review
any and all patches, as they're posted here in this mailing list.

Regards,
Luben

Quoted 44 lines

Thanks,

Nirmoy

Quoted 36 lines

If indeed we had had a memory starvation, other things would fail, before or after this sequence. And if those things are terminal, which sysfs is not, then let those other errors, such as no memory for BOs, bring the display bring-up down.

Regards,
Luben

Quoted 26 lines

Nirmoy

Quoted 8 lines
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 +---
   1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 49d10330bf64..67724049a0fc 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_fs_init(struct amdgpu_device *adev) · line 1287

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -3
@@ -1281,9 +1281,7 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
   		sysfs_bin_attr_init(bin_attrs[0]);
   	}
 
-	sysfs_create_group(&adev->dev->kobj, &group);
-
-	return 0;
+	return sysfs_create_group(&adev->dev->kobj, &group);
   }
 
   static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cluben.tuikov%40amd.com%7Cd3a29eb3223b4b58ff6b08d86163c8a9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637366428560245712&sdata=bYWjk2k8IeEolG2wcJLA7J%2Bx2d%2FOSXNIOpLObk%2F3jSQ%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx