提交 1dc20828 编写于 作者: K Kuninori Morimoto 提交者: Zhang Rui

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: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
上级 fa0d654c
...@@ -419,12 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -419,12 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv) {
dev_err(dev, "Could not allocate priv\n"); dev_err(dev, "Could not allocate priv\n");
return -ENOMEM; ret = -ENOMEM;
goto error_unregister;
} }
priv->base = devm_ioremap_resource(dev, res); priv->base = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->base)) if (IS_ERR(priv->base)) {
return PTR_ERR(priv->base); ret = PTR_ERR(priv->base);
goto error_unregister;
}
priv->common = common; priv->common = common;
priv->id = i; priv->id = i;
...@@ -443,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -443,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
goto error_unregister; goto error_unregister;
} }
list_move_tail(&priv->list, &common->head);
if (rcar_has_irq_support(priv)) if (rcar_has_irq_support(priv))
rcar_thermal_irq_enable(priv); rcar_thermal_irq_enable(priv);
list_move_tail(&priv->list, &common->head);
} }
platform_set_drvdata(pdev, common); platform_set_drvdata(pdev, common);
...@@ -456,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -456,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
return 0; return 0;
error_unregister: error_unregister:
rcar_thermal_for_each_priv(priv, common) rcar_thermal_for_each_priv(priv, common) {
thermal_zone_device_unregister(priv->zone); thermal_zone_device_unregister(priv->zone);
if (rcar_has_irq_support(priv))
rcar_thermal_irq_disable(priv);
}
return ret; return ret;
} }
...@@ -467,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev) ...@@ -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_common *common = platform_get_drvdata(pdev);
struct rcar_thermal_priv *priv; 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); thermal_zone_device_unregister(priv->zone);
if (rcar_has_irq_support(priv))
rcar_thermal_irq_disable(priv);
}
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册