Skip to content

Commit

Permalink
thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp()
Browse files Browse the repository at this point in the history
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>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Wei Yongjun authored and Zhang Rui committed Mar 11, 2013
1 parent f6161aa commit f0e68fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/thermal/rcar_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

/*
Expand All @@ -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,
Expand Down

0 comments on commit f0e68fc

Please sign in to comment.