All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cx24117: Prevent mutex to be stuck on locked state if FE init fails.
@ 2013-10-04 14:48 Luis Alves
  2013-10-04 14:52 ` Antti Palosaari
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Alves @ 2013-10-04 14:48 UTC (permalink / raw)
  To: linux-media; +Cc: mkrufky, crope, mchehab, 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


Signed-off-by: Luis Alves <ljalvs@gmail.com>
---
 drivers/media/dvb-frontends/cx24117.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c
index 9087309..476b422 100644
--- a/drivers/media/dvb-frontends/cx24117.c
+++ b/drivers/media/dvb-frontends/cx24117.c
@@ -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;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cx24117: Prevent mutex to be stuck on locked state if FE init fails.
  2013-10-04 14:48 [PATCH] cx24117: Prevent mutex to be stuck on locked state if FE init fails Luis Alves
@ 2013-10-04 14:52 ` Antti Palosaari
  0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2013-10-04 14:52 UTC (permalink / raw)
  To: Luis Alves, linux-media; +Cc: mkrufky, mchehab

On 04.10.2013 17:48, Luis Alves wrote:
> 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
>
>
> Signed-off-by: Luis Alves <ljalvs@gmail.com>

Reviewed-by: Antti Palosaari <crope@iki.fi>


> ---
>   drivers/media/dvb-frontends/cx24117.c |    9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c
> index 9087309..476b422 100644
> --- a/drivers/media/dvb-frontends/cx24117.c
> +++ b/drivers/media/dvb-frontends/cx24117.c
> @@ -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;
>


-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-04 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04 14:48 [PATCH] cx24117: Prevent mutex to be stuck on locked state if FE init fails Luis Alves
2013-10-04 14:52 ` Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.