Message ID | CAPgLHd_a8ujLyz_v+zRq00HAfKYibFd=Dq7dZfP9nCcGP=PC2Q@mail.gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Zhang Rui |
Headers | show |
Hi Wei Thank you for your patch > 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 | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c > index 909bb4b..fe694be 100644 > --- a/drivers/thermal/rcar_thermal.c > +++ b/drivers/thermal/rcar_thermal.c > @@ -174,6 +174,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) > > if (!ctemp) { > dev_err(dev, "thermal sensor was broken\n"); > + mutex_unlock(&priv->lock); > return -EINVAL; > } Nice catch ! But, can you use goto for readable code ? like this int ret = -EINVAL; mutex_lock(&priv->lock); ... if (!ctemp) { dev_err(dev, "thermal sensor was broken\n"); goto rcar_thermal_update_temp_error: } ... ret = 0; rcar_thermal_update_temp_error: mutex_unlock(&priv->lock); return ret; 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 --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 909bb4b..fe694be 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -174,6 +174,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) if (!ctemp) { dev_err(dev, "thermal sensor was broken\n"); + mutex_unlock(&priv->lock); return -EINVAL; }