diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2011-04-15 16:40:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:28:51 -0400 |
commit | 6f030abf9a77f10213bc5a2da2eff478d4d4e0c3 (patch) | |
tree | 688f987d05da108a5b84865d2e437f0eebd0b831 /drivers/media/dvb/dvb-usb | |
parent | eeaaf817c7202b71a6e1aab87ebd538d1b5e5a42 (diff) |
[media] lmedm04: Do not unlock mutex if mutex_lock_interruptible failed
There are a couple of places where mutex_unlock() is called even
if mutex_lock_interruptible() failed. The patch fixes the issue.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/lmedm04.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index 5b0f43791f77..773638475a79 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c | |||
@@ -666,9 +666,10 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
666 | else { | 666 | else { |
667 | deb_info(1, "STM Steam Off"); | 667 | deb_info(1, "STM Steam Off"); |
668 | /* mutex is here only to avoid collision with I2C */ | 668 | /* mutex is here only to avoid collision with I2C */ |
669 | ret = mutex_lock_interruptible(&adap->dev->i2c_mutex); | 669 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
670 | return -EAGAIN; | ||
670 | 671 | ||
671 | ret |= lme2510_usb_talk(adap->dev, clear_reg_3, | 672 | ret = lme2510_usb_talk(adap->dev, clear_reg_3, |
672 | sizeof(clear_reg_3), rbuf, rlen); | 673 | sizeof(clear_reg_3), rbuf, rlen); |
673 | st->stream_on = 0; | 674 | st->stream_on = 0; |
674 | st->i2c_talk_onoff = 1; | 675 | st->i2c_talk_onoff = 1; |
@@ -1099,12 +1100,13 @@ static int lme2510_powerup(struct dvb_usb_device *d, int onoff) | |||
1099 | static u8 rbuf[1]; | 1100 | static u8 rbuf[1]; |
1100 | int ret, len = 3, rlen = 1; | 1101 | int ret, len = 3, rlen = 1; |
1101 | 1102 | ||
1102 | ret = mutex_lock_interruptible(&d->i2c_mutex); | 1103 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
1104 | return -EAGAIN; | ||
1103 | 1105 | ||
1104 | if (onoff) | 1106 | if (onoff) |
1105 | ret |= lme2510_usb_talk(d, lnb_on, len, rbuf, rlen); | 1107 | ret = lme2510_usb_talk(d, lnb_on, len, rbuf, rlen); |
1106 | else | 1108 | else |
1107 | ret |= lme2510_usb_talk(d, lnb_off, len, rbuf, rlen); | 1109 | ret = lme2510_usb_talk(d, lnb_off, len, rbuf, rlen); |
1108 | 1110 | ||
1109 | st->i2c_talk_onoff = 1; | 1111 | st->i2c_talk_onoff = 1; |
1110 | 1112 | ||