aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/rcar_thermal.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2013-03-26 02:08:10 -0400
committerZhang Rui <rui.zhang@intel.com>2013-04-02 09:15:04 -0400
commit1dc20828e674a781635286072bae909dc4e5c377 (patch)
treefc262fcb5e6fa3a8ef1902e7b582065c12f8b643 /drivers/thermal/rcar_thermal.c
parentfa0d654c84c7705d90a2492b4611e1da7ccdf69c (diff)
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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/rcar_thermal.c')
-rw-r--r--drivers/thermal/rcar_thermal.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 2cc5b6115e3e..4d6095b9f9df 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)
419 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 419 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
420 if (!priv) { 420 if (!priv) {
421 dev_err(dev, "Could not allocate priv\n"); 421 dev_err(dev, "Could not allocate priv\n");
422 return -ENOMEM; 422 ret = -ENOMEM;
423 goto error_unregister;
423 } 424 }
424 425
425 priv->base = devm_ioremap_resource(dev, res); 426 priv->base = devm_ioremap_resource(dev, res);
426 if (IS_ERR(priv->base)) 427 if (IS_ERR(priv->base)) {
427 return PTR_ERR(priv->base); 428 ret = PTR_ERR(priv->base);
429 goto error_unregister;
430 }
428 431
429 priv->common = common; 432 priv->common = common;
430 priv->id = i; 433 priv->id = i;
@@ -443,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
443 goto error_unregister; 446 goto error_unregister;
444 } 447 }
445 448
446 list_move_tail(&priv->list, &common->head);
447
448 if (rcar_has_irq_support(priv)) 449 if (rcar_has_irq_support(priv))
449 rcar_thermal_irq_enable(priv); 450 rcar_thermal_irq_enable(priv);
451
452 list_move_tail(&priv->list, &common->head);
450 } 453 }
451 454
452 platform_set_drvdata(pdev, common); 455 platform_set_drvdata(pdev, common);
@@ -456,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
456 return 0; 459 return 0;
457 460
458error_unregister: 461error_unregister:
459 rcar_thermal_for_each_priv(priv, common) 462 rcar_thermal_for_each_priv(priv, common) {
460 thermal_zone_device_unregister(priv->zone); 463 thermal_zone_device_unregister(priv->zone);
464 if (rcar_has_irq_support(priv))
465 rcar_thermal_irq_disable(priv);
466 }
461 467
462 return ret; 468 return ret;
463} 469}
@@ -467,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev)
467 struct rcar_thermal_common *common = platform_get_drvdata(pdev); 473 struct rcar_thermal_common *common = platform_get_drvdata(pdev);
468 struct rcar_thermal_priv *priv; 474 struct rcar_thermal_priv *priv;
469 475
470 rcar_thermal_for_each_priv(priv, common) 476 rcar_thermal_for_each_priv(priv, common) {
471 thermal_zone_device_unregister(priv->zone); 477 thermal_zone_device_unregister(priv->zone);
478 if (rcar_has_irq_support(priv))
479 rcar_thermal_irq_disable(priv);
480 }
472 481
473 platform_set_drvdata(pdev, NULL); 482 platform_set_drvdata(pdev, NULL);
474 483