From patchwork Mon Mar 25 05:49:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2328961 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5334B3FD8C for ; Mon, 25 Mar 2013 05:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757565Ab3CYFuO (ORCPT ); Mon, 25 Mar 2013 01:50:14 -0400 Received: from mail-da0-f51.google.com ([209.85.210.51]:43753 "EHLO mail-da0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757564Ab3CYFuO (ORCPT ); Mon, 25 Mar 2013 01:50:14 -0400 Received: by mail-da0-f51.google.com with SMTP id g27so2957548dan.38 for ; Sun, 24 Mar 2013 22:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:sender:message-id:from:to:cc:in-reply-to:references :from:subject:mime-version:content-type; bh=BCIR93VoRekyzDleP0bhJM7z1Tw1Vjb4pCYeeF5r3zs=; b=mdZYjwoFTUyulpqo0bEMqMFrxDXPXR9Dn4wSHaTUr242Avm5Ix4eTGTolb22ZR1M0U I4zZzwLT79v5RDmd0YfxWTXAahq1GjrrqkJMcCECIBnU7Dy/1uXYzAOJ0fb2h4NfOBg6 zOwTWm4jN/RoIN3wa4dU/9igacTKnoFG9W4AfF8BnQBpevQrLZkRJ97sKOB9YiA8ho4m AENE53BTMO/n8J904I+pVJTGGuiba4SJwpAV7ptjPmA3HZELq/xsl4IEWL+W1knEszAu YXZKD0oaU3hS0Eu8eJWSKCfmMNvLrypTLUFD+xepX94Jy5+mYWA4jHKHNtWzWPGLhIcf C3OA== X-Received: by 10.66.228.74 with SMTP id sg10mr15992598pac.48.1364190593268; Sun, 24 Mar 2013 22:49:53 -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 zv3sm13462444pab.0.2013.03.24.22.49.50 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 24 Mar 2013 22:49:52 -0700 (PDT) Date: Sun, 24 Mar 2013 22:49:52 -0700 (PDT) Message-ID: <874ng0qb9f.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Zhang Rui Cc: Simon , Magnus , linux-pm@vger.kernel.org, Kuninori Morimoto In-Reply-To: <87620gqbbe.wl%kuninori.morimoto.gx@renesas.com> References: <87620gqbbe.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/2] 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 --- 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 28f0919..359e943 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -419,13 +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_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; @@ -444,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); @@ -457,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 -ENODEV; } @@ -468,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);