From 20dda9d37dd41db0766518fbfffa2eee36b8756e Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 1 Sep 2020 12:34:20 +0300 Subject: [PATCH] locking: turn off locking check for non-SMP configs On uniprocessor configs then there is no spin_lock functions but there are spin_unlock functions so you end up with tons of double unlock warnings. That's perhaps an over simplification of the situation and we could check for mutexes or whatever... But really uniprocessor configs are not common and this change will silence a lot of false positives without losing any real bugs. Signed-off-by: Dan Carpenter --- check_locking.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/check_locking.c b/check_locking.c index 9af6b46c..36f12145 100644 --- a/check_locking.c +++ b/check_locking.c @@ -1261,6 +1261,14 @@ void print_held_locks(void) } END_FOR_EACH_SM(sm); } +static bool is_smp_config(void) +{ + struct ident *id; + + id = built_in_ident("CONFIG_SMP"); + return !!lookup_symbol(id, NS_MACRO); +} + void check_locking(int id) { my_id = id; @@ -1268,6 +1276,9 @@ void check_locking(int id) if (option_project != PROJ_KERNEL) return; + if (!is_smp_config()) + return; + load_table(lock_table); set_dynamic_states(my_id); -- 2.11.4.GIT