From patchwork Tue Apr 2 13:17:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 2378051 Return-Path: X-Original-To: patchwork-linux-sh@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 C605EDF2A1 for ; Tue, 2 Apr 2013 13:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760508Ab3DBNRd (ORCPT ); Tue, 2 Apr 2013 09:17:33 -0400 Received: from mga02.intel.com ([134.134.136.20]:19666 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760479Ab3DBNRc (ORCPT ); Tue, 2 Apr 2013 09:17:32 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 02 Apr 2013 06:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,393,1363158000"; d="scan'208";a="288210046" Received: from unknown (HELO [10.255.20.154]) ([10.255.20.154]) by orsmga001.jf.intel.com with ESMTP; 02 Apr 2013 06:17:29 -0700 Message-ID: <1364908647.2190.39.camel@rzhang1-mobl4> Subject: Re: [PATCH 1/2 v2] thermal: rcar: tidyup registration failure case From: Zhang Rui To: Kuninori Morimoto Cc: Simon , Magnus , Kuninori Morimoto , linux-pm@vger.kernel.org, Linux-SH Date: Tue, 02 Apr 2013 21:17:27 +0800 In-Reply-To: <87ppymith5.wl%kuninori.morimoto.gx@renesas.com> References: <87620gqbbe.wl%kuninori.morimoto.gx@renesas.com> <874ng0qb9f.wl%kuninori.morimoto.gx@renesas.com> <1364200856.2465.48.camel@rzhang1-mobl4> <871ub3j9r3.wl%kuninori.morimoto.gx@renesas.com> <87sj3iiu5m.wl%kuninori.morimoto.gx@renesas.com> <87r4j2itio.wl%kuninori.morimoto.gx@renesas.com> <87ppymith5.wl%kuninori.morimoto.gx@renesas.com> X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Mon, 2013-03-25 at 23:08 -0700, Kuninori Morimoto wrote: > Current rcar_thermal driver didn't care about rcar_theraml_irq_disable() > when registration failure case on _probe(), and _remove(). > And, it returns without unregistering thermal zone when > registration failure case on _probe(). > This patch fixes these issue. > > Signed-off-by: Kuninori Morimoto rebased on thermal -next and applied. please make a double check. From 1dc20828e674a781635286072bae909dc4e5c377 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Mar 2013 06:08:10 +0000 Subject: [PATCH] thermal: rcar: tidyup registration failure case Current rcar_thermal driver didn't care about rcar_theraml_irq_disable() when registration failure case on _probe(), and _remove(). And, it returns without unregistering thermal zone when registration failure case on _probe(). This patch fixes these issue. Signed-off-by: Kuninori Morimoto Signed-off-by: Zhang Rui --- drivers/thermal/rcar_thermal.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 2cc5b61..4d6095b 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -419,12 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { dev_err(dev, "Could not allocate priv\n"); - return -ENOMEM; + ret = -ENOMEM; + goto error_unregister; } priv->base = devm_ioremap_resource(dev, res); - if (IS_ERR(priv->base)) - return PTR_ERR(priv->base); + if (IS_ERR(priv->base)) { + ret = PTR_ERR(priv->base); + goto error_unregister; + } priv->common = common; priv->id = i; @@ -443,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister; } - list_move_tail(&priv->list, &common->head); - if (rcar_has_irq_support(priv)) rcar_thermal_irq_enable(priv); + + list_move_tail(&priv->list, &common->head); } platform_set_drvdata(pdev, common); @@ -456,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev) return 0; error_unregister: - rcar_thermal_for_each_priv(priv, common) + rcar_thermal_for_each_priv(priv, common) { thermal_zone_device_unregister(priv->zone); + if (rcar_has_irq_support(priv)) + rcar_thermal_irq_disable(priv); + } return ret; } @@ -467,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev) struct rcar_thermal_common *common = platform_get_drvdata(pdev); struct rcar_thermal_priv *priv; - rcar_thermal_for_each_priv(priv, common) + rcar_thermal_for_each_priv(priv, common) { thermal_zone_device_unregister(priv->zone); + if (rcar_has_irq_support(priv)) + rcar_thermal_irq_disable(priv); + } platform_set_drvdata(pdev, NULL);