diff mbox

[-next,v2] thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp()

Message ID CAPgLHd8z1nXC1KiyFDReqayrceZCz_tzPUzWjgxjv5hjyFqdJA@mail.gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Wei Yongjun Feb. 22, 2013, 1:22 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing unlock before return from function rcar_thermal_update_temp()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/thermal/rcar_thermal.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kuninori Morimoto Feb. 24, 2013, 11:54 p.m. UTC | #1
Hi


> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Add the missing unlock before return from function rcar_thermal_update_temp()
> in the error handling case.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---

Very nice !

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

>  drivers/thermal/rcar_thermal.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 909bb4b..321a98d 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
>  	struct device *dev = rcar_priv_to_dev(priv);
>  	int i;
>  	int ctemp, old, new;
> +	int ret = -EINVAL;
>  
>  	mutex_lock(&priv->lock);
>  
> @@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
>  
>  	if (!ctemp) {
>  		dev_err(dev, "thermal sensor was broken\n");
> -		return -EINVAL;
> +		goto err_out_unlock;
>  	}
>  
>  	/*
> @@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
>  	dev_dbg(dev, "thermal%d  %d -> %d\n", priv->id, priv->ctemp, ctemp);
>  
>  	priv->ctemp = ctemp;
> -
> +	ret = 0;
> +err_out_unlock:
>  	mutex_unlock(&priv->lock);
> -
> -	return 0;
> +	return ret;
>  }
>  
>  static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto March 25, 2013, 3:36 a.m. UTC | #2
Hi Zhang

> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > 
> > Add the missing unlock before return from function rcar_thermal_update_temp()
> > in the error handling case.
> > 
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > ---
> 
> Very nice !
> 
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

I could find this patch on zhang/next branch.
(f0e68fc3caf677e834f7bd0f601800e686b56c98)
But it is required on latest linus/master branch too.
Can you please care it ?

> >  drivers/thermal/rcar_thermal.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> > index 909bb4b..321a98d 100644
> > --- a/drivers/thermal/rcar_thermal.c
> > +++ b/drivers/thermal/rcar_thermal.c
> > @@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
> >  	struct device *dev = rcar_priv_to_dev(priv);
> >  	int i;
> >  	int ctemp, old, new;
> > +	int ret = -EINVAL;
> >  
> >  	mutex_lock(&priv->lock);
> >  
> > @@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
> >  
> >  	if (!ctemp) {
> >  		dev_err(dev, "thermal sensor was broken\n");
> > -		return -EINVAL;
> > +		goto err_out_unlock;
> >  	}
> >  
> >  	/*
> > @@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
> >  	dev_dbg(dev, "thermal%d  %d -> %d\n", priv->id, priv->ctemp, ctemp);
> >  
> >  	priv->ctemp = ctemp;
> > -
> > +	ret = 0;
> > +err_out_unlock:
> >  	mutex_unlock(&priv->lock);
> > -
> > -	return 0;
> > +	return ret;
> >  }
> >  
> >  static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
> > 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> Best regards
> ---
> Kuninori Morimoto


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 909bb4b..321a98d 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -145,6 +145,7 @@  static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
 	struct device *dev = rcar_priv_to_dev(priv);
 	int i;
 	int ctemp, old, new;
+	int ret = -EINVAL;
 
 	mutex_lock(&priv->lock);
 
@@ -174,7 +175,7 @@  static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
 
 	if (!ctemp) {
 		dev_err(dev, "thermal sensor was broken\n");
-		return -EINVAL;
+		goto err_out_unlock;
 	}
 
 	/*
@@ -192,10 +193,10 @@  static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
 	dev_dbg(dev, "thermal%d  %d -> %d\n", priv->id, priv->ctemp, ctemp);
 
 	priv->ctemp = ctemp;
-
+	ret = 0;
+err_out_unlock:
 	mutex_unlock(&priv->lock);
-
-	return 0;
+	return ret;
 }
 
 static int rcar_thermal_get_temp(struct thermal_zone_device *zone,