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

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

 



> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Monday, October 23, 2017 10:46 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu/psp: Use %p for printing pointers
> 
> 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>

Reviewed-by: Alex Deucher <alexander.deucher 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
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux