V4L/DVB (13721): [Mantis] Bug! Before bailing out, Unlock
authorManu Abraham <abraham.manu@gmail.com>
Fri, 4 Dec 2009 07:40:16 +0000 (04:40 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 17 Jan 2010 13:55:31 +0000 (11:55 -0200)
Thanks to hotwings <user.vdr@gmail.com> for pointing out the bug

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/mantis/mantis_i2c.c

index 005df1e90a166574c939414f595d549dbca558ae..45d9e6bd962844cd5562d657d9187e0d1561292e 100644 (file)
@@ -133,11 +133,15 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
                        ret = mantis_i2c_write(mantis, &msgs[i]);
 
                if (ret < 0)
-                       return ret;
+                       goto bail_out;
        }
        mutex_unlock(&mantis->i2c_lock);
 
        return num;
+
+bail_out:
+       mutex_unlock(&mantis->i2c_lock);
+       return ret;
 }
 
 static u32 mantis_i2c_func(struct i2c_adapter *adapter)