diff options
Diffstat (limited to 'drivers/thermal/rcar_thermal.c')
| -rw-r--r-- | drivers/thermal/rcar_thermal.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 28f091994013..2cc5b6115e3e 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
| @@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
| 145 | struct device *dev = rcar_priv_to_dev(priv); | 145 | struct device *dev = rcar_priv_to_dev(priv); |
| 146 | int i; | 146 | int i; |
| 147 | int ctemp, old, new; | 147 | int ctemp, old, new; |
| 148 | int ret = -EINVAL; | ||
| 148 | 149 | ||
| 149 | mutex_lock(&priv->lock); | 150 | mutex_lock(&priv->lock); |
| 150 | 151 | ||
| @@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
| 174 | 175 | ||
| 175 | if (!ctemp) { | 176 | if (!ctemp) { |
| 176 | dev_err(dev, "thermal sensor was broken\n"); | 177 | dev_err(dev, "thermal sensor was broken\n"); |
| 177 | return -EINVAL; | 178 | goto err_out_unlock; |
| 178 | } | 179 | } |
| 179 | 180 | ||
| 180 | /* | 181 | /* |
| @@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
| 192 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); | 193 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); |
| 193 | 194 | ||
| 194 | priv->ctemp = ctemp; | 195 | priv->ctemp = ctemp; |
| 195 | 196 | ret = 0; | |
| 197 | err_out_unlock: | ||
| 196 | mutex_unlock(&priv->lock); | 198 | mutex_unlock(&priv->lock); |
| 197 | 199 | return ret; | |
| 198 | return 0; | ||
| 199 | } | 200 | } |
| 200 | 201 | ||
| 201 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, | 202 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, |
| @@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 363 | struct resource *res, *irq; | 364 | struct resource *res, *irq; |
| 364 | int mres = 0; | 365 | int mres = 0; |
| 365 | int i; | 366 | int i; |
| 367 | int ret = -ENODEV; | ||
| 366 | int idle = IDLE_INTERVAL; | 368 | int idle = IDLE_INTERVAL; |
| 367 | 369 | ||
| 368 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 370 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
| @@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 399 | /* | 401 | /* |
| 400 | * rcar_has_irq_support() will be enabled | 402 | * rcar_has_irq_support() will be enabled |
| 401 | */ | 403 | */ |
| 402 | common->base = devm_request_and_ioremap(dev, res); | 404 | common->base = devm_ioremap_resource(dev, res); |
| 403 | if (!common->base) { | 405 | if (IS_ERR(common->base)) |
| 404 | dev_err(dev, "Unable to ioremap thermal register\n"); | 406 | return PTR_ERR(common->base); |
| 405 | return -ENOMEM; | ||
| 406 | } | ||
| 407 | 407 | ||
| 408 | /* enable temperature comparation */ | 408 | /* enable temperature comparation */ |
| 409 | rcar_thermal_common_write(common, ENR, 0x00030303); | 409 | rcar_thermal_common_write(common, ENR, 0x00030303); |
| @@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 422 | return -ENOMEM; | 422 | return -ENOMEM; |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | priv->base = devm_request_and_ioremap(dev, res); | 425 | priv->base = devm_ioremap_resource(dev, res); |
| 426 | if (!priv->base) { | 426 | if (IS_ERR(priv->base)) |
| 427 | dev_err(dev, "Unable to ioremap priv register\n"); | 427 | return PTR_ERR(priv->base); |
| 428 | return -ENOMEM; | ||
| 429 | } | ||
| 430 | 428 | ||
| 431 | priv->common = common; | 429 | priv->common = common; |
| 432 | priv->id = i; | 430 | priv->id = i; |
| @@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 441 | idle); | 439 | idle); |
| 442 | if (IS_ERR(priv->zone)) { | 440 | if (IS_ERR(priv->zone)) { |
| 443 | dev_err(dev, "can't register thermal zone\n"); | 441 | dev_err(dev, "can't register thermal zone\n"); |
| 442 | ret = PTR_ERR(priv->zone); | ||
| 444 | goto error_unregister; | 443 | goto error_unregister; |
| 445 | } | 444 | } |
| 446 | 445 | ||
| @@ -460,7 +459,7 @@ error_unregister: | |||
| 460 | rcar_thermal_for_each_priv(priv, common) | 459 | rcar_thermal_for_each_priv(priv, common) |
| 461 | thermal_zone_device_unregister(priv->zone); | 460 | thermal_zone_device_unregister(priv->zone); |
| 462 | 461 | ||
| 463 | return -ENODEV; | 462 | return ret; |
| 464 | } | 463 | } |
| 465 | 464 | ||
| 466 | static int rcar_thermal_remove(struct platform_device *pdev) | 465 | static int rcar_thermal_remove(struct platform_device *pdev) |
