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

Michel Dänzer michel at daenzer.net
Mon Oct 23 14:45:53 UTC 2017


From: Michel Dänzer <michel.daenzer at amd.com>

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.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
index 26e10ab678fa..4e20d91d5d50 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
@@ -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;
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
index d2170500cd72..c7bcfe8e286c 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
@@ -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;
 	}
-- 
2.15.0.rc1



More information about the amd-gfx mailing list