diff options
| -rw-r--r-- | drivers/thermal/rcar_thermal.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 762f6373d50..81dce23828f 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
| @@ -185,7 +185,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 185 | struct thermal_zone_device *zone; | 185 | struct thermal_zone_device *zone; |
| 186 | struct rcar_thermal_priv *priv; | 186 | struct rcar_thermal_priv *priv; |
| 187 | struct resource *res; | 187 | struct resource *res; |
| 188 | int ret; | ||
| 189 | 188 | ||
| 190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 189 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 191 | if (!res) { | 190 | if (!res) { |
| @@ -206,16 +205,14 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 206 | res->start, resource_size(res)); | 205 | res->start, resource_size(res)); |
| 207 | if (!priv->base) { | 206 | if (!priv->base) { |
| 208 | dev_err(&pdev->dev, "Unable to ioremap thermal register\n"); | 207 | dev_err(&pdev->dev, "Unable to ioremap thermal register\n"); |
| 209 | ret = -ENOMEM; | 208 | return -ENOMEM; |
| 210 | goto error_free_priv; | ||
| 211 | } | 209 | } |
| 212 | 210 | ||
| 213 | zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv, | 211 | zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv, |
| 214 | &rcar_thermal_zone_ops, NULL, 0, 0); | 212 | &rcar_thermal_zone_ops, NULL, 0, 0); |
| 215 | if (IS_ERR(zone)) { | 213 | if (IS_ERR(zone)) { |
| 216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); | 214 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); |
| 217 | ret = PTR_ERR(zone); | 215 | return PTR_ERR(zone); |
| 218 | goto error_iounmap; | ||
| 219 | } | 216 | } |
| 220 | 217 | ||
| 221 | platform_set_drvdata(pdev, zone); | 218 | platform_set_drvdata(pdev, zone); |
| @@ -223,26 +220,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 223 | dev_info(&pdev->dev, "proved\n"); | 220 | dev_info(&pdev->dev, "proved\n"); |
| 224 | 221 | ||
| 225 | return 0; | 222 | return 0; |
| 226 | |||
| 227 | error_iounmap: | ||
| 228 | devm_iounmap(&pdev->dev, priv->base); | ||
| 229 | error_free_priv: | ||
| 230 | devm_kfree(&pdev->dev, priv); | ||
| 231 | |||
| 232 | return ret; | ||
| 233 | } | 223 | } |
| 234 | 224 | ||
| 235 | static int rcar_thermal_remove(struct platform_device *pdev) | 225 | static int rcar_thermal_remove(struct platform_device *pdev) |
| 236 | { | 226 | { |
| 237 | struct thermal_zone_device *zone = platform_get_drvdata(pdev); | 227 | struct thermal_zone_device *zone = platform_get_drvdata(pdev); |
| 238 | struct rcar_thermal_priv *priv = zone->devdata; | ||
| 239 | 228 | ||
| 240 | thermal_zone_device_unregister(zone); | 229 | thermal_zone_device_unregister(zone); |
| 241 | platform_set_drvdata(pdev, NULL); | 230 | platform_set_drvdata(pdev, NULL); |
| 242 | 231 | ||
| 243 | devm_iounmap(&pdev->dev, priv->base); | ||
| 244 | devm_kfree(&pdev->dev, priv); | ||
| 245 | |||
| 246 | return 0; | 232 | return 0; |
| 247 | } | 233 | } |
| 248 | 234 | ||
