[PATCH] check_bogus_irqrestore: Preparation work in order to add more functions
Christophe JAILLET <[email protected]> Thu, 26 May 2022 07:15:05 +0200
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <2288d268fc3a163f03cd92c2b1778f6f2e9f83d0.1653542090.git.christophe.jaillet@wanadoo.fr> |
The fact that the 'flag' parameter is the 2nd one when spin_unlock_irqrestore() is used is hard coded. Pass this information via the last argument of add_function_hook(). Signed-off-by: Christophe JAILLET <[email protected]> --- check_bogus_irqrestore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/check_bogus_irqrestore.c b/check_bogus_irqrestore.c index c47077a2f5ca..6c2b5cc17c86 100644 --- a/check_bogus_irqrestore.c +++ b/check_bogus_irqrestore.c @@ -19,12 +19,13 @@ static int my_id; -static void match_irqrestore(const char *fn, struct expression *expr, void *data) +static void match_irqrestore(const char *fn, struct expression *expr, void *_arg_nr) { + int arg_nr = PTR_INT(_arg_nr); struct expression *arg_expr; sval_t tmp; - arg_expr = get_argument_from_call_expr(expr->args, 1); + arg_expr = get_argument_from_call_expr(expr->args, arg_nr); if (!get_implied_value(arg_expr, &tmp)) return; sm_error("calling '%s()' with bogus flags", fn); @@ -36,5 +37,5 @@ void check_bogus_irqrestore(int id) return; my_id = id; - add_function_hook("spin_unlock_irqrestore", &match_irqrestore, NULL); + add_function_hook("spin_unlock_irqrestore", &match_irqrestore, INT_PTR(1)); } -- 2.34.1