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 Levonvoid func (void)
81f5207bJohn Levon{
91f5207bJohn Levon	int mylock = 1;
101f5207bJohn Levon	int mylock2 = 2;
111f5207bJohn Levon
121f5207bJohn Levon	if (1)
131f5207bJohn Levon	      	_spin_unlock(mylock);
141f5207bJohn Levon	frob();
151f5207bJohn Levon	if (a)
161f5207bJohn Levon		return;
171f5207bJohn Levon	if (!0)
181f5207bJohn Levon	      	_spin_lock(mylock);
191f5207bJohn Levon	if (0)
201f5207bJohn Levon	      	_spin_unlock(mylock);
211f5207bJohn Levon	if (b)
221f5207bJohn Levon		return;
231f5207bJohn Levon	if (!1)
241f5207bJohn Levon	      	_spin_lock(mylock);
251f5207bJohn Levon}
261f5207bJohn Levon/*
271f5207bJohn Levon * check-name: Smatch locking #4
281f5207bJohn Levon * check-command: smatch --project=kernel sm_locking4.c
291f5207bJohn Levon *
301f5207bJohn Levon * check-output-start
3131ad075John Levonsm_locking4.c:23 func() warn: inconsistent returns 'mylock'.
3231ad075John Levon  Locked on  : 22-23
3331ad075John Levon  Unlocked on: 16
341f5207bJohn Levon * check-output-end
351f5207bJohn Levon */
36