1#include "check_debug.h"
2
3unsigned long arch_local_irq_save();
4void arch_local_irq_restore(unsigned long flags);
5int spin_trylock();
6void frob();
7
8void func(int *y)
9{
10	int lock;
11	unsigned long flags;
12
13	if (({
14		int __ret;
15		flags = arch_local_irq_save();
16		__ret = spin_trylock(&lock);
17		if (!__ret)
18			arch_local_irq_restore(flags);
19		__ret;
20	    }))
21		return;
22	frob();
23}
24
25/*
26 * check-name: smatch locking #7
27 * check-command: smatch -p=kernel -I.. sm_locking7.c
28 *
29 * check-output-start
30sm_locking7.c:22 func() warn: inconsistent returns 'flags'.
31  Locked on  : 21
32  Unlocked on: 22
33sm_locking7.c:22 func() warn: inconsistent returns 'lock'.
34  Locked on  : 21
35  Unlocked on: 22
36 * check-output-end
37 */
38