* [PATCH 1/1] drm/amdkfd: Add format attribute to kfd_smi_event_add
@ 2022-03-04 14:48 Philip Yang
2022-03-04 16:32 ` Felix Kuehling
0 siblings, 1 reply; 2+ messages in thread
From: Philip Yang @ 2022-03-04 14:48 UTC (permalink / raw)
To: amd-gfx; +Cc: Philip Yang
To enable compiler type-checked against the format string in callers.
All warnings (new ones prefixed by >>):
>> warning: function 'kfd_smi_event_add' might be a candidate for
'gnu_printf' format attribute [-Wsuggest-attribute=format]
Fixes: 67e874c2fa ("drm/amdkfd: Add SMI add event helper")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
index bba8d9692a4c..02b6b26ee8f3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
@@ -176,6 +176,7 @@ static void add_event_to_kfifo(struct kfd_dev *dev, unsigned int smi_event,
rcu_read_unlock();
}
+__attribute__ ((format (printf, 3, 4)))
static void kfd_smi_event_add(struct kfd_dev *dev, unsigned int event,
char *fmt, ...)
{
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] drm/amdkfd: Add format attribute to kfd_smi_event_add
2022-03-04 14:48 [PATCH 1/1] drm/amdkfd: Add format attribute to kfd_smi_event_add Philip Yang
@ 2022-03-04 16:32 ` Felix Kuehling
0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2022-03-04 16:32 UTC (permalink / raw)
To: Philip Yang, amd-gfx
Am 2022-03-04 um 09:48 schrieb Philip Yang:
> To enable compiler type-checked against the format string in callers.
>
> All warnings (new ones prefixed by >>):
>
>>> warning: function 'kfd_smi_event_add' might be a candidate for
> 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>
> Fixes: 67e874c2fa ("drm/amdkfd: Add SMI add event helper")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> index bba8d9692a4c..02b6b26ee8f3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> @@ -176,6 +176,7 @@ static void add_event_to_kfifo(struct kfd_dev *dev, unsigned int smi_event,
> rcu_read_unlock();
> }
>
> +__attribute__ ((format (printf, 3, 4)))
I see that there is a shortcut for this defined in
include/linux/compiler_attributes.h. It's just
__printf(3, 4)
With that fixed, the patch is
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> static void kfd_smi_event_add(struct kfd_dev *dev, unsigned int event,
> char *fmt, ...)
> {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-04 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 14:48 [PATCH 1/1] drm/amdkfd: Add format attribute to kfd_smi_event_add Philip Yang
2022-03-04 16:32 ` Felix Kuehling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox