[SCSI] scsi_scan.c: Release mutex in error handling code
authorJulia Lawall <julia@diku.dk>
Mon, 21 Jul 2008 07:58:30 +0000 (09:58 +0200)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 26 Jul 2008 19:14:56 +0000 (15:14 -0400)
commit773e82f6cdb026282ff7d26aaac291a5fa84ee3a
tree755c98045690c2b6f4c588384cb46267bf487bf2
parent12265709ac6e197f4d40d9ec1fd3af97b4196a35
[SCSI] scsi_scan.c: Release mutex in error handling code

The mutex is released on a successful return, so it would seem that it
should be released on an error return as well.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression l;
@@

mutex_lock(l);
... when != mutex_unlock(l)
    when any
    when strict
(
if (...) { ... when != mutex_unlock(l)
+   mutex_unlock(l);
    return ...;
}
|
mutex_unlock(l);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_scan.c