11f5207bJohn Levonvoid _spin_lock(int name);
21f5207bJohn Levonvoid _spin_unlock(int name);
31f5207bJohn Levon
41f5207bJohn Levonvoid frob(void){}
51f5207bJohn Levonint a;
61f5207bJohn Levonint b;
71f5207bJohn Levonint c;
81f5207bJohn Levonint func (void)
91f5207bJohn Levon{
101f5207bJohn Levon	int mylock = 1;
111f5207bJohn Levon	int mylock2 = 2;
121f5207bJohn Levon
131f5207bJohn Levon	if (a == 3)
141f5207bJohn Levon	      	_spin_lock(mylock);
151f5207bJohn Levon	if (b)
161f5207bJohn Levon		frob();
171f5207bJohn Levon	if (a == 3)
181f5207bJohn Levon	      	_spin_unlock(mylock);
191f5207bJohn Levon	if (a)
201f5207bJohn Levon	      	_spin_lock(mylock);
211f5207bJohn Levon	if (c)
221f5207bJohn Levon		return 0;
231f5207bJohn Levon	if (!!a)
241f5207bJohn Levon	      	_spin_unlock(mylock);
251f5207bJohn Levon	return 0;
261f5207bJohn Levon}
271f5207bJohn Levon
281f5207bJohn Levon/*
291f5207bJohn Levon * check-name: Smatch implied #4
301f5207bJohn Levon * check-command: smatch --project=kernel --spammy sm_implied4.c
311f5207bJohn Levon *
321f5207bJohn Levon * check-output-start
331f5207bJohn Levonsm_implied4.c:22 func() warn: 'spin_lock:mylock' is sometimes locked here and sometimes unlocked.
341f5207bJohn Levon * check-output-end
351f5207bJohn Levon */
36