Re: [PATCH] unlock 12c_mutex before return

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Roel Kluin
Date: Monday, October 22, 2007 - 5:06 pm

And a similar one in drivers/media/dvb/dvb-usb/gl861.c
--
    unlock 12c_mutex before return -EINVAL
    
    Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index f01d99c..20c340a 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -59,8 +59,10 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 	if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
 		return -EAGAIN;
 
-	if (num > 2)
+	if (num > 2) {
+		mutex_unlock(&d->i2c_mutex);
 		return -EINVAL;
+	}
 
 	for (i = 0; i < num; i++) {
 		/* write/read request */

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] unlock 12c_mutex before return, Roel Kluin, (Mon Oct 22, 5:00 pm)
Re: [PATCH] unlock 12c_mutex before return, Roel Kluin, (Mon Oct 22, 5:06 pm)
Re: [PATCH] unlock 12c_mutex before return, Andreas Schwab, (Tue Oct 23, 2:50 am)
Re: [PATCH] unlock 12c_mutex before return, Roel Kluin, (Tue Oct 23, 5:32 am)