Re: [PATCH 5/5] media: atomisp: get rid of -Wsuggest-attribute=format warnings
From: Andy Shevchenko
Date: Thu Sep 03 2020 - 10:13:16 EST
On Thu, Sep 03, 2020 at 03:57:32PM +0200, Mauro Carvalho Chehab wrote:
> There are some warnings reported by gcc:
> drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:164:2: warning: function ‘atomisp_css2_dbg_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:170:2: warning: function ‘atomisp_css2_dbg_ftrace_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:170:2: warning: function ‘atomisp_css2_dbg_ftrace_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> drivers/staging/media/atomisp//pci/atomisp_compat_css20.c:176:2: warning: function ‘atomisp_css2_err_print’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>
> That are due to the usage of printf-like messages without
> enabling the error checking logic.
>
> Add the proper attributes in order to shut up such warnings.
> +static int __attribute__((format (printf, 1, 0)))
> +atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args)
> {
> ftrace_vprintk(fmt, args);
> return 0;
> }
>
Why not to drop it completely as well?
> -static int atomisp_css2_err_print(const char *fmt, va_list args)
> -{
> - vprintk(fmt, args);
> - return 0;
> -}
--
With Best Regards,
Andy Shevchenko