2019-11-14 10:07:56

by James Qian Wang

[permalink] [raw]
Subject: [PATCH] drm/komeda: Clean warnings: candidate for 'gnu_printf’ format attribute

komeda/komeda_event.c: In function ‘komeda_sprintf’:
komeda/komeda_event.c:31:2: warning: function ‘komeda_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
num = vsnprintf(str->str + str->len, free_sz, fmt, args);

v2: Update the comment msg.

Signed-off-by: james qian wang (Arm Technology China) <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index bf269683f811..977c38d516da 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -17,6 +17,7 @@ struct komeda_str {

/* return 0 on success, < 0 on no space.
*/
+__printf(2, 3)
static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
{
va_list args;
--
2.20.1


2019-11-15 00:05:15

by Mihail Atanassov

[permalink] [raw]
Subject: Re: [PATCH] drm/komeda: Clean warnings: candi date for 'gnu_printf’ format attribute

On Thursday, 14 November 2019 10:04:37 GMT james qian wang (Arm Technology China) wrote:
> komeda/komeda_event.c: In function ‘komeda_sprintf’:
> komeda/komeda_event.c:31:2: warning: function ‘komeda_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> num = vsnprintf(str->str + str->len, free_sz, fmt, args);
>
> v2: Update the comment msg.
>
> Signed-off-by: james qian wang (Arm Technology China) <[email protected]>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index bf269683f811..977c38d516da 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -17,6 +17,7 @@ struct komeda_str {
>
> /* return 0 on success, < 0 on no space.
> */
> +__printf(2, 3)
> static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
> {
> va_list args;
> --
> 2.20.1
>
>

Reviewed-by: Mihail Atanassov <[email protected]>

--
Mihail