From: Julia Lawall Date: Sun, 20 Jun 2010 11:24:35 +0000 (+0200) Subject: HID: eliminate a double lock in debug code X-Git-Tag: v2.6.35-rc5~4^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca9fe1588427f246ad4c389b0170b29a432804b6;p=pandora-kernel.git HID: eliminate a double lock in debug code The path around the loop ends with the lock held, so the call to mutex_lock is moved before the beginning of the loop. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @locked@ expression E1; position p; @@ read_lock(E1@p,...); @r exists@ expression x <= locked.E1; expression locked.E1; expression E2; identifier lock; position locked.p,p1,p2; @@ *lock@p1 (E1@p,...); ... when != E1 when != \(x = E2\|&x\) *lock@p2 (E1,...); // Signed-off-by: Julia Lawall Signed-off-by: Jiri Kosina --- Reading git-diff-tree failed