From patchwork Fri Feb 22 13:22:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2176051 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6619CDFABD for ; Fri, 22 Feb 2013 13:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756852Ab3BVNWl (ORCPT ); Fri, 22 Feb 2013 08:22:41 -0500 Received: from mail-bk0-f44.google.com ([209.85.214.44]:43227 "EHLO mail-bk0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756700Ab3BVNWl (ORCPT ); Fri, 22 Feb 2013 08:22:41 -0500 Received: by mail-bk0-f44.google.com with SMTP id j4so284756bkw.17 for ; Fri, 22 Feb 2013 05:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=MDiOIQIPLm7A2uwgYp/nLBHhwB9Lq+5bO5PW+AIDwyQ=; b=nkVRARy4bdaIEdHrNkwEl0OXbIxuUjWZ6OIUKvS8t7eSVfkEdqirz7joNtzm7O84Gp SpkY09/ByIUi9SOKAargz7as6VQmiDXyvwSk3z5n/L7ymo433sHDG2zft7CP83NBmh8F EYrhDsckqlDo27DPDHGIHQURRFiMDKjWq62lS2wA+G3tCXaPsVPDLcuZNfrUikwjW2mb ClLAllLTy0lxT1dKNXW8uJlqA91gYxrMnBNqjQGzDlAx0VIKU3FFGEQtb8dKDzeviI/b XIP3abCPB4R6tTTSK/5+NAYoHHTceMcvrzJXJCC523rpBZTwlosH7gBHYVatCgpQhyLb gQhA== MIME-Version: 1.0 X-Received: by 10.204.147.82 with SMTP id k18mr1006885bkv.38.1361539359655; Fri, 22 Feb 2013 05:22:39 -0800 (PST) Received: by 10.204.30.210 with HTTP; Fri, 22 Feb 2013 05:22:39 -0800 (PST) Date: Fri, 22 Feb 2013 21:22:39 +0800 Message-ID: Subject: [PATCH -next v2] thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp() From: Wei Yongjun To: rui.zhang@intel.com, grant.likely@secretlab.ca, rob.herring@calxeda.com, kuninori.morimoto.gx@renesas.com Cc: yongjun_wei@trendmicro.com.cn, linux-pm@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Wei Yongjun Add the missing unlock before return from function rcar_thermal_update_temp() in the error handling case. Signed-off-by: Wei Yongjun Acked-by: Kuninori Morimoto --- 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 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,