From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 1/2 v2] thermal: rcar: tidyup registration failure case Date: Mon, 25 Mar 2013 23:08:10 -0700 (PDT) Message-ID: <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> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <87r4j2itio.wl%kuninori.morimoto.gx@renesas.com> Sender: linux-sh-owner@vger.kernel.org To: Zhang Rui Cc: Simon , Magnus , Kuninori Morimoto , linux-pm@vger.kernel.org, Linux-SH List-Id: 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); -- 1.7.9.5