Skip to contentSkip to conversation

cx24117: Prevent mutex to be stuck on locked state if FE init fails.

PATCH In review Luis Alves 2 participants 2 messages Oct 4, 2013 Media (V4L/DVB)

lore
Share & tools
lore

Luis Alves

author
#0 lore raw

PATCH 1/1 cx24117: Prevent mutex to be stuck on locked state if FE init fails.

Hi,
This patch will fix the situation where the mutex was left in a locked state if for some reason the FE init failed.

Regards,
Luis

---
 drivers/media/dvb-frontends/cx24117.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/cx24117.c +4 -5
index 9087309..476b422 100644
@@ -1238,11 +1238,11 @@ static int cx24117_initfe(struct dvb_frontend *fe)
 	cmd.len = 3;
 	ret = cx24117_cmd_execute_nolock(fe, &cmd);
 	if (ret != 0)
-		return ret;
+		goto exit;
 
 	ret = cx24117_diseqc_init(fe);
 	if (ret != 0)
-		return ret;
+		goto exit;
 
 	/* CMD 3C */
 	cmd.args[0] = 0x3c;
@@ -1252,7 +1252,7 @@ static int cx24117_initfe(struct dvb_frontend *fe)
 	cmd.len = 4;
 	ret = cx24117_cmd_execute_nolock(fe, &cmd);
 	if (ret != 0)
-		return ret;
+		goto exit;
 
 	/* CMD 34 */
 	cmd.args[0] = 0x34;
@@ -1260,9 +1260,8 @@ static int cx24117_initfe(struct dvb_frontend *fe)
 	cmd.args[2] = CX24117_OCC;
 	cmd.len = 3;
 	ret = cx24117_cmd_execute_nolock(fe, &cmd);
-	if (ret != 0)
-		return ret;
 
+exit:
 	mutex_unlock(&state->priv->fe_lock);
 
 	return ret;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Luis Alves

Hi,
This patch will fix the situation where the mutex was left in a locked state if for some reason the FE init failed.

Regards,
Luis

Quoted 43 lines
---
  drivers/media/dvb-frontends/cx24117.c |    9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/cx24117.c +4 -5
index 9087309..476b422 100644
@@ -1238,11 +1238,11 @@ static int cx24117_initfe(struct dvb_frontend *fe)
  	cmd.len = 3;
  	ret = cx24117_cmd_execute_nolock(fe, &cmd);
  	if (ret != 0)
-		return ret;
+		goto exit;
 
  	ret = cx24117_diseqc_init(fe);
  	if (ret != 0)
-		return ret;
+		goto exit;
 
  	/* CMD 3C */
  	cmd.args[0] = 0x3c;
@@ -1252,7 +1252,7 @@ static int cx24117_initfe(struct dvb_frontend *fe)
  	cmd.len = 4;
  	ret = cx24117_cmd_execute_nolock(fe, &cmd);
  	if (ret != 0)
-		return ret;
+		goto exit;
 
  	/* CMD 34 */
  	cmd.args[0] = 0x34;
@@ -1260,9 +1260,8 @@ static int cx24117_initfe(struct dvb_frontend *fe)
  	cmd.args[2] = CX24117_OCC;
  	cmd.len = 3;
  	ret = cx24117_cmd_execute_nolock(fe, &cmd);
-	if (ret != 0)
-		return ret;
 
+exit:
  	mutex_unlock(&state->priv->fe_lock);
 
  	return ret;
Signature · 1 line
http://palosaari.fi/