1 #include "check_debug.h"
   2 
   3 unsigned long arch_local_irq_save();
   4 void arch_local_irq_restore(unsigned long flags);
   5 int spin_trylock();
   6 void frob();
   7 
   8 void 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
  30 sm_locking7.c:22 func() warn: inconsistent returns 'irqsave:flags'.
  31   Locked on:   line 21
  32   Unlocked on: line 22
  33 sm_locking7.c:22 func() warn: inconsistent returns 'spin_lock:&lock'.
  34   Locked on:   line 21
  35   Unlocked on: line 22
  36  * check-output-end
  37  */