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.
Unified · Split
| @@ -159,24 +159,13 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n) · 158 unmodified lines | |||
| 159 | spin_unlock_irqrestore(&mmio_lock, flags); | 159 | spin_unlock_irqrestore(&mmio_lock, flags); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static int atomisp_css2_dbg_print(const char *fmt, va_list args) | 162 | static int __attribute__((format (printf, 1, 0))) |
| 163 | { | 163 | atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args) |
| 164 | vprintk(fmt, args); | ||
| 165 | return 0; | ||
| 166 | } | ||
| 167 | |||
| 168 | static int atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args) | ||
| 169 | { | 164 | { |
| 170 | ftrace_vprintk(fmt, args); | 165 | ftrace_vprintk(fmt, args); |
| 171 | return 0; | 166 | return 0; |
| 172 | } | 167 | } |
| 173 | 168 | ||
| 174 | static int atomisp_css2_err_print(const char *fmt, va_list args) | ||
| 175 | { | ||
| 176 | vprintk(fmt, args); | ||
| 177 | return 0; | ||
| 178 | } | ||
| 179 | |||
| 180 | void atomisp_load_uint32(hrt_address addr, uint32_t *data) | 169 | void atomisp_load_uint32(hrt_address addr, uint32_t *data) |
| 181 | { | 170 | { |
| 182 | *data = atomisp_css2_hw_load_32(addr); | 171 | *data = atomisp_css2_hw_load_32(addr); |
| @@ -869,8 +858,7 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt) · 686 unmodified lines | |||
| 869 | isp->css_env.isp_css_env.print_env.debug_print = | 858 | isp->css_env.isp_css_env.print_env.debug_print = |
| 870 | atomisp_css2_dbg_ftrace_print; | 859 | atomisp_css2_dbg_ftrace_print; |
| 871 | else if (opt == 2) | 860 | else if (opt == 2) |
| 872 | isp->css_env.isp_css_env.print_env.debug_print = | 861 | isp->css_env.isp_css_env.print_env.debug_print = vprintk; |
| 873 | atomisp_css2_dbg_print; | ||
| 874 | else | 862 | else |
| 875 | ret = -EINVAL; | 863 | ret = -EINVAL; |
| 876 | 864 | ||
| @@ -903,7 +891,7 @@ int atomisp_css_load_firmware(struct atomisp_device *isp) · 26 unmodified lines | |||
| 903 | 891 | ||
| 904 | __set_css_print_env(isp, dbg_func); | 892 | __set_css_print_env(isp, dbg_func); |
| 905 | 893 | ||
| 906 | isp->css_env.isp_css_env.print_env.error_print = atomisp_css2_err_print; | 894 | isp->css_env.isp_css_env.print_env.error_print = vprintk; |
| 907 | 895 | ||
| 908 | /* load isp fw into ISP memory */ | 896 | /* load isp fw into ISP memory */ |
| 909 | err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env, | 897 | err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env, |
| @@ -20,7 +20,8 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | extern int (*sh_css_printf)(const char *fmt, va_list args); | 21 | extern int (*sh_css_printf)(const char *fmt, va_list args); |
| 22 | /* depends on host supplied print function in ia_css_init() */ | 22 | /* depends on host supplied print function in ia_css_init() */ |
| 23 | static inline void ia_css_print(const char *fmt, ...) | 23 | static inline __attribute__((format (printf, 1, 0))) |
| 24 | void ia_css_print(const char *fmt, ...) | ||
| 24 | { | 25 | { |
| 25 | va_list ap; | 26 | va_list ap; |
| 26 | 27 | ||
| @@ -75,9 +75,9 @@ struct ia_css_hw_access_env { · 74 unmodified lines | |||
| 75 | /* Environment with function pointers to print error and debug messages. | 75 | /* Environment with function pointers to print error and debug messages. |
| 76 | */ | 76 | */ |
| 77 | struct ia_css_print_env { | 77 | struct ia_css_print_env { |
| 78 | int (*debug_print)(const char *fmt, va_list args); | 78 | int (*debug_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0))); |
| 79 | /** Print a debug message. */ | 79 | /** Print a debug message. */ |
| 80 | int (*error_print)(const char *fmt, va_list args); | 80 | int (*error_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0))); |
| 81 | /** Print an error message.*/ | 81 | /** Print an error message.*/ |
| 82 | }; | 82 | }; |
| 83 | 83 | ||