Skip to contentSkip to conversation

amdgpu: use NULL instead of 0 for pointer

PATCH Applied Arnd Bergmann 3 participants 3 messages Jun 15, 2016

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

PATCH 1/1 amdgpu: use NULL instead of 0 for pointer

In the AMD powerplay driver, a pointer is checked for validity by comparing against an integer '0', which causes a harmless warning when building with "make W=1":

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:1502:16: error: ordered comparison of pointer with integer zero [-Werror=extra]

This changes the code to the more conventional "if (pointer)" check.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -1
index 2f1a14fe05b1..b64f42d2c3ae 100644
@@ -1499,7 +1499,7 @@ int get_number_of_vce_state_table_entries(
 	const ATOM_PPLIB_VCE_State_Table *vce_table =
 				    get_vce_state_table(hwmgr, table);
 
-	if (vce_table > 0)
+	if (vce_table)
 		return vce_table->numEntries;
 
 	return 0;
Signature · 1 line
2.9.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 15.06.2016 um 22:15 schrieb Arnd Bergmann:

Quoted 9 lines

In the AMD powerplay driver, a pointer is checked for validity by comparing against an integer '0', which causes a harmless warning when building with "make W=1":

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:1502:16: error: ordered comparison of pointer with integer zero [-Werror=extra]

This changes the code to the more conventional "if (pointer)" check.

Quoted 9 lines
---
  drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -0
index 2f1a14fe05b1..b64f42d2c3ae 100644

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c int get_number_of_vce_state_table_entries( · line 1505

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -1
@@ -1499,7 +1499,7 @@ int get_number_of_vce_state_table_entries(
  	const ATOM_PPLIB_VCE_State_Table *vce_table =
  				    get_vce_state_table(hwmgr, table);
 
-	if (vce_table > 0)
+	if (vce_table)
  		return vce_table->numEntries;
 
  	return 0;

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

Applied
#2 lore raw
Quoted 9 lines · Christian König

Am 15.06.2016 um 22:15 schrieb Arnd Bergmann:

Quoted 8 lines

In the AMD powerplay driver, a pointer is checked for validity by comparing against an integer '0', which causes a harmless warning when building with "make W=1":

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:1502:16:
error: ordered comparison of pointer with integer zero [-Werror=extra]

Quoted 6 lines
Quoted 3 lines

This changes the code to the more conventional "if (pointer)" check.

Applied. thanks!

Alex

Quoted 15 lines
Quoted 15 lines
---
  drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -0
index 2f1a14fe05b1..b64f42d2c3ae 100644
@@ -1499,7 +1499,7 @@ int get_number_of_vce_state_table_entries(
        const ATOM_PPLIB_VCE_State_Table *vce_table =
                                    get_vce_state_table(hwmgr, table);
  -     if (vce_table > 0)
+       if (vce_table)
Quoted 8 lines

drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c int get_number_of_vce_state_table_entries( · line 1505

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +0 -0
                return vce_table->numEntries;
        return 0;

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

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