media: atomisp: get rid of -Wsuggest-attribute=format warnings

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]
	drivers/staging/media/atomisp/pci/sh_css.c:1685:16: warning: assignment left-hand side might be a candidate for a 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.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-09-03 13:56:30 +02:00
parent b38f7aaef8
commit 72a9ff3bf7
3 changed files with 8 additions and 19 deletions

View File

@ -159,24 +159,13 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n)
spin_unlock_irqrestore(&mmio_lock, flags);
}
static int atomisp_css2_dbg_print(const char *fmt, va_list args)
{
vprintk(fmt, args);
return 0;
}
static int atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args)
static int __attribute__((format (printf, 1, 0)))
atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args)
{
ftrace_vprintk(fmt, args);
return 0;
}
static int atomisp_css2_err_print(const char *fmt, va_list args)
{
vprintk(fmt, args);
return 0;
}
void atomisp_load_uint32(hrt_address addr, uint32_t *data)
{
*data = atomisp_css2_hw_load_32(addr);
@ -869,8 +858,7 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt)
isp->css_env.isp_css_env.print_env.debug_print =
atomisp_css2_dbg_ftrace_print;
else if (opt == 2)
isp->css_env.isp_css_env.print_env.debug_print =
atomisp_css2_dbg_print;
isp->css_env.isp_css_env.print_env.debug_print = vprintk;
else
ret = -EINVAL;
@ -903,7 +891,7 @@ int atomisp_css_load_firmware(struct atomisp_device *isp)
__set_css_print_env(isp, dbg_func);
isp->css_env.isp_css_env.print_env.error_print = atomisp_css2_err_print;
isp->css_env.isp_css_env.print_env.error_print = vprintk;
/* load isp fw into ISP memory */
err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env,

View File

@ -20,7 +20,8 @@
extern int (*sh_css_printf)(const char *fmt, va_list args);
/* depends on host supplied print function in ia_css_init() */
static inline void ia_css_print(const char *fmt, ...)
static inline __attribute__((format (printf, 1, 0)))
void ia_css_print(const char *fmt, ...)
{
va_list ap;

View File

@ -75,9 +75,9 @@ struct ia_css_hw_access_env {
/* Environment with function pointers to print error and debug messages.
*/
struct ia_css_print_env {
int (*debug_print)(const char *fmt, va_list args);
int (*debug_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0)));
/** Print a debug message. */
int (*error_print)(const char *fmt, va_list args);
int (*error_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0)));
/** Print an error message.*/
};