staging: nvec: release sync write lock in error case
authorMarc Dietrich <marvin24@gmx.de>
Sun, 19 Aug 2012 17:03:07 +0000 (19:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Sep 2012 20:18:14 +0000 (13:18 -0700)
We forgot to release the sync write lock in case the async write
fails. Found by rpiloose on IRC.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/nvec/nvec.c

index 3e090ecc2eac364a4407a603a5107986e962264f..fd84f8fd9533bda00c47a53ae295b77828fe7c53 100644 (file)
@@ -294,8 +294,10 @@ struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec,
 
        nvec->sync_write_pending = (data[1] << 8) + data[0];
 
-       if (nvec_write_async(nvec, data, size) < 0)
+       if (nvec_write_async(nvec, data, size) < 0) {
+               mutex_unlock(&nvec->sync_write_mutex);
                return NULL;
+       }
 
        dev_dbg(nvec->dev, "nvec_sync_write: 0x%04x\n",
                                        nvec->sync_write_pending);