Skip to contentSkip to conversation

drm/amdgpu/psp: Use %p for printing pointers

PATCH In review Michel Dänzer 3 participants 3 messages Oct 23, 2017 1 message not in the archive

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

PATCH 1/1 drm/amdgpu/psp: Use %p for printing pointers

From: Michel Dänzer <[email protected]>

The compiler was warning:

In file included from drivers/gpu/drm//amd/amdgpu/amdgpu.h:45:0,

                 from drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:27:
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c: In function ‘psp_v10_0_cmd_submit’:
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
   DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
   DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
   DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~

While at it, fix the formatting of the second line, making the code smaller and easier to read.

---
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 6 ++----
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c  | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +2 -4
index 26e10ab678fa..4e20d91d5d50 100644
@@ -274,10 +274,8 @@ int psp_v10_0_cmd_submit(struct psp_context *psp,
 		write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw);
 	/* Check invalid write_frame ptr address */
 	if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n",
+			  ring_buffer_start, ring_buffer_end, write_frame);
 		DRM_ERROR("write_frame is pointing to address out of bounds\n");
 		return -EINVAL;
 	}
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +2 -4
index d2170500cd72..c7bcfe8e286c 100644
@@ -386,10 +386,8 @@ int psp_v3_1_cmd_submit(struct psp_context *psp,
 		write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw);
 	/* Check invalid write_frame ptr address */
 	if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n",
+			  ring_buffer_start, ring_buffer_end, write_frame);
 		DRM_ERROR("write_frame is pointing to address out of bounds\n");
 		return -EINVAL;
 	}
Signature · 6 lines
2.15.0.rc1

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

A message that is not in the archive (sent off-list or not yet received): 20171023144553.27979-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw

Am 23.10.2017 um 16:45 schrieb Michel Dänzer:

Quoted 24 lines

From: Michel Dänzer <[email protected]>

The compiler was warning:

In file included from drivers/gpu/drm//amd/amdgpu/amdgpu.h:45:0,

                  from drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:27:

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c: In function ‘psp_v10_0_cmd_submit’:
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)

                                     ^~~

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)

                                     ^~~

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)

Quoted 6 lines
                                     ^~~

While at it, fix the formatting of the second line, making the code smaller and easier to read.

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 6 ++----
  drivers/gpu/drm/amd/amdgpu/psp_v3_1.c  | 6 ++----
  2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +2 -4
index 26e10ab678fa..4e20d91d5d50 100644
@@ -274,10 +274,8 @@ int psp_v10_0_cmd_submit(struct psp_context *psp,
  		write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw);
  	/* Check invalid write_frame ptr address */
  	if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n",
+			  ring_buffer_start, ring_buffer_end, write_frame);
  		DRM_ERROR("write_frame is pointing to address out of bounds\n");
  		return -EINVAL;
  	}
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +0 -0
index d2170500cd72..c7bcfe8e286c 100644
@@ -386,10 +386,8 @@ int psp_v3_1_cmd_submit(struct psp_context *psp,
  		write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw);
  	/* Check invalid write_frame ptr address */

drivers/gpu/drm/amd/amdgpu/psp_v3_1.c int psp_v3_1_cmd_submit(struct psp_context *psp, · line 393

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +2 -4
  	if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n",
+			  ring_buffer_start, ring_buffer_end, write_frame);
  		DRM_ERROR("write_frame is pointing to address out of bounds\n");
  		return -EINVAL;
  	}

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

Reviewed-by Alex Deucher
#3 lore raw
In reply to a message not in the archive
Quoted 43 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, October 23, 2017 10:46 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu/psp: Use %p for printing pointers

From: Michel Dänzer <[email protected]>

The compiler was warning:

In file included from drivers/gpu/drm//amd/amdgpu/amdgpu.h:45:0,

                 from drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:27:

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c: In function ‘psp_v10_0_cmd_submit’:
drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame
= %x\n",

             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame
= %x\n",

             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~

drivers/gpu/drm//amd/amdgpu/psp_v10_0.c:277:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘struct psp_gfx_rb_frame *’ [-Wformat=]
DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x; write_frame
= %x\n",

             ^
./include/drm/drmP.h:178:36: note: in definition of macro ‘DRM_ERROR’
  drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__)
                                    ^~~
Quoted 4 lines

While at it, fix the formatting of the second line, making the code smaller and easier to read.

Quoted 55 lines
---
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 6 ++----
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c  | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +1 -4
index 26e10ab678fa..4e20d91d5d50 100644
@@ -274,10 +274,8 @@ int psp_v10_0_cmd_submit(struct psp_context
 *psp,
 		write_frame = ring_buffer_start + (psp_write_ptr_reg /
 rb_frame_size_dw);
 	/* Check invalid write_frame ptr address */
 	if ((write_frame < ring_buffer_start) || (ring_buffer_end <
 write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x;
 write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end =

%p; write_frame = %p\n",

drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +1 -0
+			  ring_buffer_start, ring_buffer_end, write_frame);
 		DRM_ERROR("write_frame is pointing to address out of

bounds\n");

drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +0 -0
 		return -EINVAL;
 	}
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +1 -4
index d2170500cd72..c7bcfe8e286c 100644
@@ -386,10 +386,8 @@ int psp_v3_1_cmd_submit(struct psp_context *psp,
 		write_frame = ring_buffer_start + (psp_write_ptr_reg /
 rb_frame_size_dw);
 	/* Check invalid write_frame ptr address */
 	if ((write_frame < ring_buffer_start) || (ring_buffer_end <
 write_frame)) {
-		DRM_ERROR("ring_buffer_start = %x; ring_buffer_end = %x;
 write_frame = %x\n",
-				ring_buffer_start,
-				ring_buffer_end,
-				write_frame);
+		DRM_ERROR("ring_buffer_start = %p; ring_buffer_end =

%p; write_frame = %p\n",

drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +1 -0
+			  ring_buffer_start, ring_buffer_end, write_frame);
 		DRM_ERROR("write_frame is pointing to address out of

bounds\n");

drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +0 -1
 		return -EINVAL;
 	}
--

2.15.0.rc1

Quoted 4 lines

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

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