1 void dev_hold(int *x); 2 3 void dev_put(int *x){} 4 5 extern int y,z; 6 int *x; 7 8 int func (void) 9 { 10 dev_hold(x); 11 if (y) { 12 dev_put(x); 13 return -1; 14 } 15 if (z) { 16 return -1; 17 } 18 return 0; 19 } 20 /* 21 * check-name: dev_hold() check 22 * check-command: smatch --project=kernel sm_dev_hold.c 23 * 24 * check-output-start 25 sm_dev_hold.c:16 func() warn: 'x' held on error path. 26 * check-output-end 27 */