Skip to contentSkip to conversation

af9035: unlock on error in af9035_i2c_master_xfer()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 22, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 af9035: unlock on error in af9035_i2c_master_xfer()

We introduced a couple new error paths which are missing unlocks.

Fixes 7760e148350b ('[media] af9035: Don't use dynamic static allocation')
drivers/media/usb/dvb-usb-v2/af9035.c +5 -2
index c8fcd78425bd..625ef2489b23 100644
@@ -245,7 +245,8 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
 				dev_warn(&d->udev->dev,
 					 "%s: i2c xfer: len=%d is too big!\n",
 					 KBUILD_MODNAME, msg[0].len);
-				return -EOPNOTSUPP;
+				ret = -EOPNOTSUPP;
+				goto unlock;
 			}
 			req.mbox |= ((msg[0].addr & 0x80)  >>  3);
 			buf[0] = msg[1].len;
@@ -281,7 +282,8 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
 				dev_warn(&d->udev->dev,
 					 "%s: i2c xfer: len=%d is too big!\n",
 					 KBUILD_MODNAME, msg[0].len);
-				return -EOPNOTSUPP;
+				ret = -EOPNOTSUPP;
+				goto unlock;
 			}
 			req.mbox |= ((msg[0].addr & 0x80)  >>  3);
 			buf[0] = msg[0].len;
@@ -319,6 +321,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
 		ret = -EOPNOTSUPP;
 	}
 
+unlock:
 	mutex_unlock(&d->i2c_mutex);
 
 	if (ret < 0)
Acked-by on v1 1/1
#1 lore raw

Antti

Quoted 38 lines · Dan Carpenter

We introduced a couple new error paths which are missing unlocks.

Fixes 7760e148350b ('[media] af9035: Don't use dynamic static allocation')
drivers/media/usb/dvb-usb-v2/af9035.c +5 -2
index c8fcd78425bd..625ef2489b23 100644
@@ -245,7 +245,8 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
  				dev_warn(&d->udev->dev,
  					 "%s: i2c xfer: len=%d is too big!\n",
  					 KBUILD_MODNAME, msg[0].len);
-				return -EOPNOTSUPP;
+				ret = -EOPNOTSUPP;
+				goto unlock;
  			}
  			req.mbox |= ((msg[0].addr & 0x80)  >>  3);
  			buf[0] = msg[1].len;
@@ -281,7 +282,8 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
  				dev_warn(&d->udev->dev,
  					 "%s: i2c xfer: len=%d is too big!\n",
  					 KBUILD_MODNAME, msg[0].len);
-				return -EOPNOTSUPP;
+				ret = -EOPNOTSUPP;
+				goto unlock;
  			}
  			req.mbox |= ((msg[0].addr & 0x80)  >>  3);
  			buf[0] = msg[0].len;
@@ -319,6 +321,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
  		ret = -EOPNOTSUPP;
  	}
 
+unlock:
  	mutex_unlock(&d->i2c_mutex);
 
  	if (ret < 0)
Signature · 1 line
http://palosaari.fi/