From fcb9bbce01b2bb6fff667e190308186b8936c8db Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 28 Nov 2009 18:59:57 +0200 Subject: [PATCH] revert part of f4a459292e339 Hm... I figured out what that code was supposed to do. Added a test case so I don't chop it out again. Signed-off-by: Dan Carpenter --- smatch_extra.c | 6 ++++-- validation/sm_locking5.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 validation/sm_locking5.c diff --git a/smatch_extra.c b/smatch_extra.c index 5bc994eb..9299f5a3 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -450,8 +450,10 @@ static void match_comparison(struct expression *expr) } if (varies->type == EXPR_PREOP || varies->type == EXPR_POSTOP) varies = varies->unop; - if (varies->type == EXPR_CALL) - return; + if (varies->type == EXPR_CALL) { + function_comparison(comparison, varies, fixed, left); + return; + } name = get_variable_from_expr(varies, &sym); if (!name || !sym) diff --git a/validation/sm_locking5.c b/validation/sm_locking5.c new file mode 100644 index 00000000..94fcc55f --- /dev/null +++ b/validation/sm_locking5.c @@ -0,0 +1,18 @@ +int mutex_lock_interruptible(int x); +void mutex_unlock(int x); + +void frob(void) { + int lock; + + if (mutex_lock_interruptible(lock) < 0) + return; + return; +} +/* + * check-name: Smatch locking #5 + * check-command: smatch -p=kernel sm_locking5.c + * + * check-output-start +sm_locking5.c +9 frob(5) warn: inconsistent returns lock: locked (9) unlocked (8) + * check-output-end + */ -- 2.11.4.GIT