From patchwork Tue Mar 26 06:08:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2334901 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 17857DF264 for ; Tue, 26 Mar 2013 06:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759392Ab3CZGNf (ORCPT ); Tue, 26 Mar 2013 02:13:35 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:56847 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755062Ab3CZGNf (ORCPT ); Tue, 26 Mar 2013 02:13:35 -0400 Received: by mail-pd0-f170.google.com with SMTP id 4so2882810pdd.15 for ; Mon, 25 Mar 2013 23:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:sender:message-id:to:cc:in-reply-to:references:from :subject:mime-version:content-type; bh=PezbNTVipVSaQZ6Ev2ij/fHgW3f9gKeF03OTsET/hSs=; b=PjGj3iSHRyhdZKaR3yEg18Q68RldrwSfLa6hqW+YUTEa26uyurN1hOmVnJ0GDnTAk+ //HqKe7+H/paQypnyavYSuHdwwE4KEd6EDQDg4jVd326rWS0VaeUG7O30v4GbdXaulr9 6DYi/7MvzunrYbXXxOpTYpIiAykuiDGmqgP7MPnNCaGgpyAb8IkRuMq6FJGqC9yRR9Hk 2a+2ApTJ3NGpBGaz1tOzioY3ehuBzbncbyttAa7Ao5tcQsB+vmkOi3Ou7z8wDshAAwil 3ZG6ZwpZHxyDPKqShA9o6nMuzT2/bt+ETi0q1kmKdX/TOPb+pMuk4RHGGNu2Fr1zsUuU UUqg== X-Received: by 10.66.120.49 with SMTP id kz17mr1330548pab.133.1364278091270; Mon, 25 Mar 2013 23:08:11 -0700 (PDT) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPS id rl3sm16221268pbb.28.2013.03.25.23.08.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 25 Mar 2013 23:08:10 -0700 (PDT) Date: Mon, 25 Mar 2013 23:08:10 -0700 (PDT) Message-ID: <87ppymith5.wl%kuninori.morimoto.gx@renesas.com> To: Zhang Rui Cc: Simon , Magnus , Kuninori Morimoto , linux-pm@vger.kernel.org, Linux-SH In-Reply-To: <87r4j2itio.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> From: Kuninori Morimoto Subject: [PATCH 1/2 v2] thermal: rcar: tidyup registration failure case MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- v1 -> v2 - same as v1 drivers/thermal/rcar_thermal.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index c490aa5..c199623 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -421,13 +421,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_request_and_ioremap(dev, res); if (!priv->base) { dev_err(dev, "Unable to ioremap priv register\n"); - return -ENOMEM; + ret = -ENOMEM; + goto error_unregister; } priv->common = common; @@ -447,10 +449,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); @@ -460,8 +462,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; } @@ -471,8 +476,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);