[Skiboot] [PATCH 05/25] sparse: fix function argument test
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Wed Feb 25 03:10:44 AEDT 2015
On 02/24/2015 04:44 PM, Cédric Le Goater wrote:
> It fixes warnings such as
>
> "Using plain integer as NULL pointer"
>
> when the prototype of the function is tested with the __test_args#
> defines.
>
FYI.. I believe this should and accompany kernel side changes as well. Otherwise
we will endup out of sync again!
-Vasant
> Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
> ---
> include/opal-api.h | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/include/opal-api.h b/include/opal-api.h
> index 4e05d59eb8a7..74445b0af1c7 100644
> --- a/include/opal-api.h
> +++ b/include/opal-api.h
> @@ -27,10 +27,17 @@ struct opal_table_entry {
> __be32 nargs;
> };
>
> +#ifdef __CHECKER__
> +#define __opal_func_test_arg(__func, __nargs) 0
> +#else
> +#define __opal_func_test_arg(__func, __nargs) \
> + sizeof(__func( __test_args##__nargs ))
> +#endif
> +
> #define opal_call(__tok, __func, __nargs) \
> static struct opal_table_entry __e_##__func __used __section(".opal_table") = \
> { .func = __func, .token = __tok, \
> - .nargs = __nargs + 0 * sizeof(__func( __test_args##__nargs )) }
> + .nargs = __nargs + 0 * __opal_func_test_arg(__func, __nargs) }
>
> /* Make sure function takes args they claim. Look away now... */
> #define __test_args0
> @@ -56,7 +63,7 @@ void opal_dynamic_event_free(__be64 event);
> extern void add_opal_node(void);
>
> #define opal_register(token, func, nargs) \
> - __opal_register((token) + 0*sizeof(func(__test_args##nargs)), \
> + __opal_register((token) + 0*__opal_func_test_arg(func, nargs), \
> (func), (nargs))
> extern void __opal_register(__be64 token, void *func, unsigned num_args);
>
>
More information about the Skiboot
mailing list